package com.usoft.credit.grpc.api;

import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;

/**
 * <pre>
 * 征信查询服务
 * 使用 mvn compile, 插件生成的代码不完全
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.11.0)",
    comments = "Source: GrpcQueryService.proto")
public final class GrpcQueryServiceGrpc {

  private GrpcQueryServiceGrpc() {}

  public static final String SERVICE_NAME = "GrpcQueryService";

  // Static method descriptors that strictly reflect the proto.
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @Deprecated // Use {@link #getQueryEnMethod()} instead.
  public static final io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest,
      com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse> METHOD_QUERY_EN = getQueryEnMethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest,
      com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse> getQueryEnMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest,
      com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse> getQueryEnMethod() {
    return getQueryEnMethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest,
      com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse> getQueryEnMethodHelper() {
    io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest, com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse> getQueryEnMethod;
    if ((getQueryEnMethod = GrpcQueryServiceGrpc.getQueryEnMethod) == null) {
      synchronized (GrpcQueryServiceGrpc.class) {
        if ((getQueryEnMethod = GrpcQueryServiceGrpc.getQueryEnMethod) == null) {
          GrpcQueryServiceGrpc.getQueryEnMethod = getQueryEnMethod = 
              io.grpc.MethodDescriptor.<com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest, com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "GrpcQueryService", "queryEn"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new GrpcQueryServiceMethodDescriptorSupplier("queryEn"))
                  .build();
          }
        }
     }
     return getQueryEnMethod;
  }
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  @Deprecated // Use {@link #getQueryPersonMethod()} instead.
  public static final io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.PersonQueryRequest,
      com.usoft.credit.grpc.api.protobuf.PersonJsonResponse> METHOD_QUERY_PERSON = getQueryPersonMethodHelper();

  private static volatile io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.PersonQueryRequest,
      com.usoft.credit.grpc.api.protobuf.PersonJsonResponse> getQueryPersonMethod;

  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.PersonQueryRequest,
      com.usoft.credit.grpc.api.protobuf.PersonJsonResponse> getQueryPersonMethod() {
    return getQueryPersonMethodHelper();
  }

  private static io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.PersonQueryRequest,
      com.usoft.credit.grpc.api.protobuf.PersonJsonResponse> getQueryPersonMethodHelper() {
    io.grpc.MethodDescriptor<com.usoft.credit.grpc.api.protobuf.PersonQueryRequest, com.usoft.credit.grpc.api.protobuf.PersonJsonResponse> getQueryPersonMethod;
    if ((getQueryPersonMethod = GrpcQueryServiceGrpc.getQueryPersonMethod) == null) {
      synchronized (GrpcQueryServiceGrpc.class) {
        if ((getQueryPersonMethod = GrpcQueryServiceGrpc.getQueryPersonMethod) == null) {
          GrpcQueryServiceGrpc.getQueryPersonMethod = getQueryPersonMethod = 
              io.grpc.MethodDescriptor.<com.usoft.credit.grpc.api.protobuf.PersonQueryRequest, com.usoft.credit.grpc.api.protobuf.PersonJsonResponse>newBuilder()
              .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
              .setFullMethodName(generateFullMethodName(
                  "GrpcQueryService", "queryPerson"))
              .setSampledToLocalTracing(true)
              .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.usoft.credit.grpc.api.protobuf.PersonQueryRequest.getDefaultInstance()))
              .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
                  com.usoft.credit.grpc.api.protobuf.PersonJsonResponse.getDefaultInstance()))
                  .setSchemaDescriptor(new GrpcQueryServiceMethodDescriptorSupplier("queryPerson"))
                  .build();
          }
        }
     }
     return getQueryPersonMethod;
  }

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

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

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

  /**
   * <pre>
   * 征信查询服务
   * 使用 mvn compile, 插件生成的代码不完全
   * </pre>
   */
  public static abstract class GrpcQueryServiceImplBase implements io.grpc.BindableService {

    /**
     * <pre>
     * 获取企业信用信息
     * </pre>
     */
    public void queryEn(com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest request,
        io.grpc.stub.StreamObserver<com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getQueryEnMethodHelper(), responseObserver);
    }

    /**
     * <pre>
     * 获取个人信用信息
     * </pre>
     */
    public void queryPerson(com.usoft.credit.grpc.api.protobuf.PersonQueryRequest request,
        io.grpc.stub.StreamObserver<com.usoft.credit.grpc.api.protobuf.PersonJsonResponse> responseObserver) {
      asyncUnimplementedUnaryCall(getQueryPersonMethodHelper(), responseObserver);
    }

    @Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            getQueryEnMethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest,
                com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse>(
                  this, METHODID_QUERY_EN)))
          .addMethod(
            getQueryPersonMethodHelper(),
            asyncUnaryCall(
              new MethodHandlers<
                com.usoft.credit.grpc.api.protobuf.PersonQueryRequest,
                com.usoft.credit.grpc.api.protobuf.PersonJsonResponse>(
                  this, METHODID_QUERY_PERSON)))
          .build();
    }
  }

  /**
   * <pre>
   * 征信查询服务
   * 使用 mvn compile, 插件生成的代码不完全
   * </pre>
   */
  public static final class GrpcQueryServiceStub extends io.grpc.stub.AbstractStub<GrpcQueryServiceStub> {
    private GrpcQueryServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

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

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

    /**
     * <pre>
     * 获取企业信用信息
     * </pre>
     */
    public void queryEn(com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest request,
        io.grpc.stub.StreamObserver<com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getQueryEnMethodHelper(), getCallOptions()), request, responseObserver);
    }

    /**
     * <pre>
     * 获取个人信用信息
     * </pre>
     */
    public void queryPerson(com.usoft.credit.grpc.api.protobuf.PersonQueryRequest request,
        io.grpc.stub.StreamObserver<com.usoft.credit.grpc.api.protobuf.PersonJsonResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(getQueryPersonMethodHelper(), getCallOptions()), request, responseObserver);
    }
  }

  /**
   * <pre>
   * 征信查询服务
   * 使用 mvn compile, 插件生成的代码不完全
   * </pre>
   */
  public static final class GrpcQueryServiceBlockingStub extends io.grpc.stub.AbstractStub<GrpcQueryServiceBlockingStub> {
    private GrpcQueryServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

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

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

    /**
     * <pre>
     * 获取企业信用信息
     * </pre>
     */
    public com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse queryEn(com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest request) {
      return blockingUnaryCall(
          getChannel(), getQueryEnMethodHelper(), getCallOptions(), request);
    }

    /**
     * <pre>
     * 获取个人信用信息
     * </pre>
     */
    public com.usoft.credit.grpc.api.protobuf.PersonJsonResponse queryPerson(com.usoft.credit.grpc.api.protobuf.PersonQueryRequest request) {
      return blockingUnaryCall(
          getChannel(), getQueryPersonMethodHelper(), getCallOptions(), request);
    }
  }

  /**
   * <pre>
   * 征信查询服务
   * 使用 mvn compile, 插件生成的代码不完全
   * </pre>
   */
  public static final class GrpcQueryServiceFutureStub extends io.grpc.stub.AbstractStub<GrpcQueryServiceFutureStub> {
    private GrpcQueryServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

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

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

    /**
     * <pre>
     * 获取企业信用信息
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse> queryEn(
        com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getQueryEnMethodHelper(), getCallOptions()), request);
    }

    /**
     * <pre>
     * 获取个人信用信息
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.usoft.credit.grpc.api.protobuf.PersonJsonResponse> queryPerson(
        com.usoft.credit.grpc.api.protobuf.PersonQueryRequest request) {
      return futureUnaryCall(
          getChannel().newCall(getQueryPersonMethodHelper(), getCallOptions()), request);
    }
  }

  private static final int METHODID_QUERY_EN = 0;
  private static final int METHODID_QUERY_PERSON = 1;

  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 GrpcQueryServiceImplBase serviceImpl;
    private final int methodId;

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

    @Override
    @SuppressWarnings("unchecked")
    public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
      switch (methodId) {
        case METHODID_QUERY_EN:
          serviceImpl.queryEn((com.usoft.credit.grpc.api.protobuf.EnterpriseQueryRequest) request,
              (io.grpc.stub.StreamObserver<com.usoft.credit.grpc.api.protobuf.EnterpriseJsonResponse>) responseObserver);
          break;
        case METHODID_QUERY_PERSON:
          serviceImpl.queryPerson((com.usoft.credit.grpc.api.protobuf.PersonQueryRequest) request,
              (io.grpc.stub.StreamObserver<com.usoft.credit.grpc.api.protobuf.PersonJsonResponse>) responseObserver);
          break;
        default:
          throw new AssertionError();
      }
    }

    @Override
    @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 GrpcQueryServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    GrpcQueryServiceBaseDescriptorSupplier() {}

    @Override
    public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
      return com.usoft.credit.grpc.api.protobuf.GrpcQueryServiceProto.getDescriptor();
    }

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

  private static final class GrpcQueryServiceFileDescriptorSupplier
      extends GrpcQueryServiceBaseDescriptorSupplier {
    GrpcQueryServiceFileDescriptorSupplier() {}
  }

  private static final class GrpcQueryServiceMethodDescriptorSupplier
      extends GrpcQueryServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

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

    @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 (GrpcQueryServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new GrpcQueryServiceFileDescriptorSupplier())
              .addMethod(getQueryEnMethodHelper())
              .addMethod(getQueryPersonMethodHelper())
              .build();
        }
      }
    }
    return result;
  }
}
