package com.ywt.gapi.base.file;

import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;

/**
 * <pre>
 * 对应 base-service 项目的 file.js 文件
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.7.2-SNAPSHOT)",
    comments = "Source: file.proto")
public final class FileServiceGrpc {

  private FileServiceGrpc() {}

  public static final String SERVICE_NAME = "com.ywt.gapi.base.file.FileService";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static final io.grpc.MethodDescriptor<com.ywt.gapi.base.file.UploadFileRequest,
      com.ywt.gapi.base.file.UploadFileResponse> METHOD_UPLOAD_FILE =
      io.grpc.MethodDescriptor.<com.ywt.gapi.base.file.UploadFileRequest, com.ywt.gapi.base.file.UploadFileResponse>newBuilder()
          .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
          .setFullMethodName(generateFullMethodName(
              "com.ywt.gapi.base.file.FileService", "uploadFile"))
          .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.base.file.UploadFileRequest.getDefaultInstance()))
          .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.base.file.UploadFileResponse.getDefaultInstance()))
          .setSchemaDescriptor(new FileServiceMethodDescriptorSupplier("uploadFile"))
          .build();
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static final io.grpc.MethodDescriptor<com.ywt.gapi.base.file.ReadFileRequest,
      com.ywt.gapi.base.file.ReadFileResponse> METHOD_READ_FILE =
      io.grpc.MethodDescriptor.<com.ywt.gapi.base.file.ReadFileRequest, com.ywt.gapi.base.file.ReadFileResponse>newBuilder()
          .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
          .setFullMethodName(generateFullMethodName(
              "com.ywt.gapi.base.file.FileService", "readFile"))
          .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.base.file.ReadFileRequest.getDefaultInstance()))
          .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.base.file.ReadFileResponse.getDefaultInstance()))
          .setSchemaDescriptor(new FileServiceMethodDescriptorSupplier("readFile"))
          .build();
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static final io.grpc.MethodDescriptor<com.ywt.gapi.base.file.ReadFileFromBucketRequest,
      com.ywt.gapi.base.file.ReadFileResponse> METHOD_READ_FILE_FROM_BUCKET =
      io.grpc.MethodDescriptor.<com.ywt.gapi.base.file.ReadFileFromBucketRequest, com.ywt.gapi.base.file.ReadFileResponse>newBuilder()
          .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
          .setFullMethodName(generateFullMethodName(
              "com.ywt.gapi.base.file.FileService", "readFileFromBucket"))
          .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.base.file.ReadFileFromBucketRequest.getDefaultInstance()))
          .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.base.file.ReadFileResponse.getDefaultInstance()))
          .setSchemaDescriptor(new FileServiceMethodDescriptorSupplier("readFileFromBucket"))
          .build();

  /**
   * Creates a new async stub that supports all call types for the service
   */
  public static FileServiceStub newStub(io.grpc.Channel channel) {
    return new FileServiceStub(channel);
  }

  /**
   * Creates a new blocking-style stub that supports unary and streaming output calls on the service
   */
  public static FileServiceBlockingStub newBlockingStub(
      io.grpc.Channel channel) {
    return new FileServiceBlockingStub(channel);
  }

  /**
   * Creates a new ListenableFuture-style stub that supports unary calls on the service
   */
  public static FileServiceFutureStub newFutureStub(
      io.grpc.Channel channel) {
    return new FileServiceFutureStub(channel);
  }

  /**
   * <pre>
   * 对应 base-service 项目的 file.js 文件
   * </pre>
   */
  public static abstract class FileServiceImplBase implements io.grpc.BindableService {

    /**
     */
    public void uploadFile(com.ywt.gapi.base.file.UploadFileRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.base.file.UploadFileResponse> responseObserver) {
      asyncUnimplementedUnaryCall(METHOD_UPLOAD_FILE, responseObserver);
    }

    /**
     */
    public void readFile(com.ywt.gapi.base.file.ReadFileRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.base.file.ReadFileResponse> responseObserver) {
      asyncUnimplementedUnaryCall(METHOD_READ_FILE, responseObserver);
    }

    /**
     * <pre>
     *根据bucket读取文件
     * </pre>
     */
    public void readFileFromBucket(com.ywt.gapi.base.file.ReadFileFromBucketRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.base.file.ReadFileResponse> responseObserver) {
      asyncUnimplementedUnaryCall(METHOD_READ_FILE_FROM_BUCKET, responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            METHOD_UPLOAD_FILE,
            asyncUnaryCall(
              new MethodHandlers<
                com.ywt.gapi.base.file.UploadFileRequest,
                com.ywt.gapi.base.file.UploadFileResponse>(
                  this, METHODID_UPLOAD_FILE)))
          .addMethod(
            METHOD_READ_FILE,
            asyncUnaryCall(
              new MethodHandlers<
                com.ywt.gapi.base.file.ReadFileRequest,
                com.ywt.gapi.base.file.ReadFileResponse>(
                  this, METHODID_READ_FILE)))
          .addMethod(
            METHOD_READ_FILE_FROM_BUCKET,
            asyncUnaryCall(
              new MethodHandlers<
                com.ywt.gapi.base.file.ReadFileFromBucketRequest,
                com.ywt.gapi.base.file.ReadFileResponse>(
                  this, METHODID_READ_FILE_FROM_BUCKET)))
          .build();
    }
  }

  /**
   * <pre>
   * 对应 base-service 项目的 file.js 文件
   * </pre>
   */
  public static final class FileServiceStub extends io.grpc.stub.AbstractStub<FileServiceStub> {
    private FileServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

    private FileServiceStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected FileServiceStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new FileServiceStub(channel, callOptions);
    }

    /**
     */
    public void uploadFile(com.ywt.gapi.base.file.UploadFileRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.base.file.UploadFileResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_UPLOAD_FILE, getCallOptions()), request, responseObserver);
    }

    /**
     */
    public void readFile(com.ywt.gapi.base.file.ReadFileRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.base.file.ReadFileResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_READ_FILE, getCallOptions()), request, responseObserver);
    }

    /**
     * <pre>
     *根据bucket读取文件
     * </pre>
     */
    public void readFileFromBucket(com.ywt.gapi.base.file.ReadFileFromBucketRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.base.file.ReadFileResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_READ_FILE_FROM_BUCKET, getCallOptions()), request, responseObserver);
    }
  }

  /**
   * <pre>
   * 对应 base-service 项目的 file.js 文件
   * </pre>
   */
  public static final class FileServiceBlockingStub extends io.grpc.stub.AbstractStub<FileServiceBlockingStub> {
    private FileServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

    private FileServiceBlockingStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected FileServiceBlockingStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new FileServiceBlockingStub(channel, callOptions);
    }

    /**
     */
    public com.ywt.gapi.base.file.UploadFileResponse uploadFile(com.ywt.gapi.base.file.UploadFileRequest request) {
      return blockingUnaryCall(
          getChannel(), METHOD_UPLOAD_FILE, getCallOptions(), request);
    }

    /**
     */
    public com.ywt.gapi.base.file.ReadFileResponse readFile(com.ywt.gapi.base.file.ReadFileRequest request) {
      return blockingUnaryCall(
          getChannel(), METHOD_READ_FILE, getCallOptions(), request);
    }

    /**
     * <pre>
     *根据bucket读取文件
     * </pre>
     */
    public com.ywt.gapi.base.file.ReadFileResponse readFileFromBucket(com.ywt.gapi.base.file.ReadFileFromBucketRequest request) {
      return blockingUnaryCall(
          getChannel(), METHOD_READ_FILE_FROM_BUCKET, getCallOptions(), request);
    }
  }

  /**
   * <pre>
   * 对应 base-service 项目的 file.js 文件
   * </pre>
   */
  public static final class FileServiceFutureStub extends io.grpc.stub.AbstractStub<FileServiceFutureStub> {
    private FileServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

    private FileServiceFutureStub(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      super(channel, callOptions);
    }

    @java.lang.Override
    protected FileServiceFutureStub build(io.grpc.Channel channel,
        io.grpc.CallOptions callOptions) {
      return new FileServiceFutureStub(channel, callOptions);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<com.ywt.gapi.base.file.UploadFileResponse> uploadFile(
        com.ywt.gapi.base.file.UploadFileRequest request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_UPLOAD_FILE, getCallOptions()), request);
    }

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<com.ywt.gapi.base.file.ReadFileResponse> readFile(
        com.ywt.gapi.base.file.ReadFileRequest request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_READ_FILE, getCallOptions()), request);
    }

    /**
     * <pre>
     *根据bucket读取文件
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.ywt.gapi.base.file.ReadFileResponse> readFileFromBucket(
        com.ywt.gapi.base.file.ReadFileFromBucketRequest request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_READ_FILE_FROM_BUCKET, getCallOptions()), request);
    }
  }

  private static final int METHODID_UPLOAD_FILE = 0;
  private static final int METHODID_READ_FILE = 1;
  private static final int METHODID_READ_FILE_FROM_BUCKET = 2;

  private static final class MethodHandlers<Req, Resp> implements
      io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
      io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
    private final FileServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(FileServiceImplBase serviceImpl, int methodId) {
      this.serviceImpl = serviceImpl;
      this.methodId = methodId;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_UPLOAD_FILE:
          serviceImpl.uploadFile((com.ywt.gapi.base.file.UploadFileRequest) request,
              (io.grpc.stub.StreamObserver<com.ywt.gapi.base.file.UploadFileResponse>) responseObserver);
          break;
        case METHODID_READ_FILE:
          serviceImpl.readFile((com.ywt.gapi.base.file.ReadFileRequest) request,
              (io.grpc.stub.StreamObserver<com.ywt.gapi.base.file.ReadFileResponse>) responseObserver);
          break;
        case METHODID_READ_FILE_FROM_BUCKET:
          serviceImpl.readFileFromBucket((com.ywt.gapi.base.file.ReadFileFromBucketRequest) request,
              (io.grpc.stub.StreamObserver<com.ywt.gapi.base.file.ReadFileResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("unchecked")
    public io.grpc.stub.StreamObserver<Req> invoke(
        io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        default:
          throw new AssertionError();
      }
    }
  }

  private static abstract class FileServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    FileServiceBaseDescriptorSupplier() {}

    @java.lang.Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.ywt.gapi.base.file.File.getDescriptor();
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
      return getFileDescriptor().findServiceByName("FileService");
    }
  }

  private static final class FileServiceFileDescriptorSupplier
      extends FileServiceBaseDescriptorSupplier {
    FileServiceFileDescriptorSupplier() {}
  }

  private static final class FileServiceMethodDescriptorSupplier
      extends FileServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    FileServiceMethodDescriptorSupplier(String methodName) {
      this.methodName = methodName;
    }

    @java.lang.Override
    public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
      return getServiceDescriptor().findMethodByName(methodName);
    }
  }

  private static volatile io.grpc.ServiceDescriptor serviceDescriptor;

  public static io.grpc.ServiceDescriptor getServiceDescriptor() {
    io.grpc.ServiceDescriptor result = serviceDescriptor;
    if (result == null) {
      synchronized (FileServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new FileServiceFileDescriptorSupplier())
              .addMethod(METHOD_UPLOAD_FILE)
              .addMethod(METHOD_READ_FILE)
              .addMethod(METHOD_READ_FILE_FROM_BUCKET)
              .build();
        }
      }
    }
    return result;
  }
}
