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>
 * 短信发送服务     // 对应 MsgService 项目的 SmsProvider 类
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.7.2-SNAPSHOT)",
    comments = "Source: message.proto")
public final class SmsMessageServiceGrpc {

  private SmsMessageServiceGrpc() {}

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

  // 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.SendSmsRequest,
      com.ywt.gapi.message.SendSmsResponse> METHOD_SEND_SMS =
      io.grpc.MethodDescriptor.<com.ywt.gapi.message.SendSmsRequest, com.ywt.gapi.message.SendSmsResponse>newBuilder()
          .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
          .setFullMethodName(generateFullMethodName(
              "com.ywt.gapi.message.SmsMessageService", "sendSms"))
          .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.message.SendSmsRequest.getDefaultInstance()))
          .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.message.SendSmsResponse.getDefaultInstance()))
          .setSchemaDescriptor(new SmsMessageServiceMethodDescriptorSupplier("sendSms"))
          .build();

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

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

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

  /**
   * <pre>
   * 短信发送服务     // 对应 MsgService 项目的 SmsProvider 类
   * </pre>
   */
  public static abstract class SmsMessageServiceImplBase implements io.grpc.BindableService {

    /**
     */
    public void sendSms(com.ywt.gapi.message.SendSmsRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.message.SendSmsResponse> responseObserver) {
      asyncUnimplementedUnaryCall(METHOD_SEND_SMS, responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            METHOD_SEND_SMS,
            asyncUnaryCall(
              new MethodHandlers<
                com.ywt.gapi.message.SendSmsRequest,
                com.ywt.gapi.message.SendSmsResponse>(
                  this, METHODID_SEND_SMS)))
          .build();
    }
  }

  /**
   * <pre>
   * 短信发送服务     // 对应 MsgService 项目的 SmsProvider 类
   * </pre>
   */
  public static final class SmsMessageServiceStub extends io.grpc.stub.AbstractStub<SmsMessageServiceStub> {
    private SmsMessageServiceStub(io.grpc.Channel channel) {
      super(channel);
    }

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

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

    /**
     */
    public void sendSms(com.ywt.gapi.message.SendSmsRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.message.SendSmsResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_SEND_SMS, getCallOptions()), request, responseObserver);
    }
  }

  /**
   * <pre>
   * 短信发送服务     // 对应 MsgService 项目的 SmsProvider 类
   * </pre>
   */
  public static final class SmsMessageServiceBlockingStub extends io.grpc.stub.AbstractStub<SmsMessageServiceBlockingStub> {
    private SmsMessageServiceBlockingStub(io.grpc.Channel channel) {
      super(channel);
    }

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

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

    /**
     */
    public com.ywt.gapi.message.SendSmsResponse sendSms(com.ywt.gapi.message.SendSmsRequest request) {
      return blockingUnaryCall(
          getChannel(), METHOD_SEND_SMS, getCallOptions(), request);
    }
  }

  /**
   * <pre>
   * 短信发送服务     // 对应 MsgService 项目的 SmsProvider 类
   * </pre>
   */
  public static final class SmsMessageServiceFutureStub extends io.grpc.stub.AbstractStub<SmsMessageServiceFutureStub> {
    private SmsMessageServiceFutureStub(io.grpc.Channel channel) {
      super(channel);
    }

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

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

    /**
     */
    public com.google.common.util.concurrent.ListenableFuture<com.ywt.gapi.message.SendSmsResponse> sendSms(
        com.ywt.gapi.message.SendSmsRequest request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_SEND_SMS, getCallOptions()), request);
    }
  }

  private static final int METHODID_SEND_SMS = 0;

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

    MethodHandlers(SmsMessageServiceImplBase 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:
          serviceImpl.sendSms((com.ywt.gapi.message.SendSmsRequest) request,
              (io.grpc.stub.StreamObserver<com.ywt.gapi.message.SendSmsResponse>) 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 SmsMessageServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    SmsMessageServiceBaseDescriptorSupplier() {}

    @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("SmsMessageService");
    }
  }

  private static final class SmsMessageServiceFileDescriptorSupplier
      extends SmsMessageServiceBaseDescriptorSupplier {
    SmsMessageServiceFileDescriptorSupplier() {}
  }

  private static final class SmsMessageServiceMethodDescriptorSupplier
      extends SmsMessageServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    SmsMessageServiceMethodDescriptorSupplier(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 (SmsMessageServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new SmsMessageServiceFileDescriptorSupplier())
              .addMethod(METHOD_SEND_SMS)
              .build();
        }
      }
    }
    return result;
  }
}
