package com.ywt.gapi.message;

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>
 *消息中心服务      // 对应 rpc 项目的 MessageServiceImpl 类
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.7.2-SNAPSHOT)",
    comments = "Source: message.proto")
public final class MessageServiceGrpc {

  private MessageServiceGrpc() {}

  public static final String SERVICE_NAME = "com.ywt.gapi.message.MessageService";

  // 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.message.SendSmsCodeRequest,
      com.ywt.gapi.message.SendSmsCodeResponse> METHOD_SEND_SMS_CODE =
      io.grpc.MethodDescriptor.<com.ywt.gapi.message.SendSmsCodeRequest, com.ywt.gapi.message.SendSmsCodeResponse>newBuilder()
          .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
          .setFullMethodName(generateFullMethodName(
              "com.ywt.gapi.message.MessageService", "sendSmsCode"))
          .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.message.SendSmsCodeRequest.getDefaultInstance()))
          .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.message.SendSmsCodeResponse.getDefaultInstance()))
          .setSchemaDescriptor(new MessageServiceMethodDescriptorSupplier("sendSmsCode"))
          .build();
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static final io.grpc.MethodDescriptor<com.ywt.gapi.message.NotifyAfterCreatePrescriptionRequest,
      com.ywt.gapi.Result> METHOD_NOTIFY_AFTER_CREATE_PRESCRIPTION =
      io.grpc.MethodDescriptor.<com.ywt.gapi.message.NotifyAfterCreatePrescriptionRequest, com.ywt.gapi.Result>newBuilder()
          .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
          .setFullMethodName(generateFullMethodName(
              "com.ywt.gapi.message.MessageService", "notifyAfterCreatePrescription"))
          .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.message.NotifyAfterCreatePrescriptionRequest.getDefaultInstance()))
          .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.Result.getDefaultInstance()))
          .setSchemaDescriptor(new MessageServiceMethodDescriptorSupplier("notifyAfterCreatePrescription"))
          .build();

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

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

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

  /**
   * <pre>
   *消息中心服务      // 对应 rpc 项目的 MessageServiceImpl 类
   * </pre>
   */
  public static abstract class MessageServiceImplBase implements io.grpc.BindableService {

    /**
     * <pre>
     *发送短信验证码
     * </pre>
     */
    public void sendSmsCode(com.ywt.gapi.message.SendSmsCodeRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.message.SendSmsCodeResponse> responseObserver) {
      asyncUnimplementedUnaryCall(METHOD_SEND_SMS_CODE, responseObserver);
    }

    /**
     * <pre>
     *通知用户收到处方单
     * </pre>
     */
    public void notifyAfterCreatePrescription(com.ywt.gapi.message.NotifyAfterCreatePrescriptionRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.Result> responseObserver) {
      asyncUnimplementedUnaryCall(METHOD_NOTIFY_AFTER_CREATE_PRESCRIPTION, responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            METHOD_SEND_SMS_CODE,
            asyncUnaryCall(
              new MethodHandlers<
                com.ywt.gapi.message.SendSmsCodeRequest,
                com.ywt.gapi.message.SendSmsCodeResponse>(
                  this, METHODID_SEND_SMS_CODE)))
          .addMethod(
            METHOD_NOTIFY_AFTER_CREATE_PRESCRIPTION,
            asyncUnaryCall(
              new MethodHandlers<
                com.ywt.gapi.message.NotifyAfterCreatePrescriptionRequest,
                com.ywt.gapi.Result>(
                  this, METHODID_NOTIFY_AFTER_CREATE_PRESCRIPTION)))
          .build();
    }
  }

  /**
   * <pre>
   *消息中心服务      // 对应 rpc 项目的 MessageServiceImpl 类
   * </pre>
   */
  public static final class MessageServiceStub extends io.grpc.stub.AbstractStub<MessageServiceStub> {
    private MessageServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

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

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

    /**
     * <pre>
     *发送短信验证码
     * </pre>
     */
    public void sendSmsCode(com.ywt.gapi.message.SendSmsCodeRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.message.SendSmsCodeResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_SEND_SMS_CODE, getCallOptions()), request, responseObserver);
    }

    /**
     * <pre>
     *通知用户收到处方单
     * </pre>
     */
    public void notifyAfterCreatePrescription(com.ywt.gapi.message.NotifyAfterCreatePrescriptionRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.Result> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_NOTIFY_AFTER_CREATE_PRESCRIPTION, getCallOptions()), request, responseObserver);
    }
  }

  /**
   * <pre>
   *消息中心服务      // 对应 rpc 项目的 MessageServiceImpl 类
   * </pre>
   */
  public static final class MessageServiceBlockingStub extends io.grpc.stub.AbstractStub<MessageServiceBlockingStub> {
    private MessageServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

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

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

    /**
     * <pre>
     *发送短信验证码
     * </pre>
     */
    public com.ywt.gapi.message.SendSmsCodeResponse sendSmsCode(com.ywt.gapi.message.SendSmsCodeRequest request) {
      return blockingUnaryCall(
          getChannel(), METHOD_SEND_SMS_CODE, getCallOptions(), request);
    }

    /**
     * <pre>
     *通知用户收到处方单
     * </pre>
     */
    public com.ywt.gapi.Result notifyAfterCreatePrescription(com.ywt.gapi.message.NotifyAfterCreatePrescriptionRequest request) {
      return blockingUnaryCall(
          getChannel(), METHOD_NOTIFY_AFTER_CREATE_PRESCRIPTION, getCallOptions(), request);
    }
  }

  /**
   * <pre>
   *消息中心服务      // 对应 rpc 项目的 MessageServiceImpl 类
   * </pre>
   */
  public static final class MessageServiceFutureStub extends io.grpc.stub.AbstractStub<MessageServiceFutureStub> {
    private MessageServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

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

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

    /**
     * <pre>
     *发送短信验证码
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.ywt.gapi.message.SendSmsCodeResponse> sendSmsCode(
        com.ywt.gapi.message.SendSmsCodeRequest request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_SEND_SMS_CODE, getCallOptions()), request);
    }

    /**
     * <pre>
     *通知用户收到处方单
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.ywt.gapi.Result> notifyAfterCreatePrescription(
        com.ywt.gapi.message.NotifyAfterCreatePrescriptionRequest request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_NOTIFY_AFTER_CREATE_PRESCRIPTION, getCallOptions()), request);
    }
  }

  private static final int METHODID_SEND_SMS_CODE = 0;
  private static final int METHODID_NOTIFY_AFTER_CREATE_PRESCRIPTION = 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 MessageServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(MessageServiceImplBase 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_SEND_SMS_CODE:
          serviceImpl.sendSmsCode((com.ywt.gapi.message.SendSmsCodeRequest) request,
              (io.grpc.stub.StreamObserver<com.ywt.gapi.message.SendSmsCodeResponse>) responseObserver);
          break;
        case METHODID_NOTIFY_AFTER_CREATE_PRESCRIPTION:
          serviceImpl.notifyAfterCreatePrescription((com.ywt.gapi.message.NotifyAfterCreatePrescriptionRequest) request,
              (io.grpc.stub.StreamObserver<com.ywt.gapi.Result>) 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 MessageServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    MessageServiceBaseDescriptorSupplier() {}

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

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

  private static final class MessageServiceFileDescriptorSupplier
      extends MessageServiceBaseDescriptorSupplier {
    MessageServiceFileDescriptorSupplier() {}
  }

  private static final class MessageServiceMethodDescriptorSupplier
      extends MessageServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    MessageServiceMethodDescriptorSupplier(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 (MessageServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new MessageServiceFileDescriptorSupplier())
              .addMethod(METHOD_SEND_SMS_CODE)
              .addMethod(METHOD_NOTIFY_AFTER_CREATE_PRESCRIPTION)
              .build();
        }
      }
    }
    return result;
  }
}
