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 项目的 EmailProvider 类
 * </pre>
 */
@javax.annotation.Generated(
    value = "by gRPC proto compiler (version 1.7.2-SNAPSHOT)",
    comments = "Source: message.proto")
public final class EmailServiceGrpc {

  private EmailServiceGrpc() {}

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

  // 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.SendMerchantEmailRequest,
      com.ywt.gapi.message.SendMerchantEmailResponse> METHOD_SEND_MERCHANT_EMAIL =
      io.grpc.MethodDescriptor.<com.ywt.gapi.message.SendMerchantEmailRequest, com.ywt.gapi.message.SendMerchantEmailResponse>newBuilder()
          .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
          .setFullMethodName(generateFullMethodName(
              "com.ywt.gapi.message.EmailService", "sendMerchantEmail"))
          .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.message.SendMerchantEmailRequest.getDefaultInstance()))
          .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.message.SendMerchantEmailResponse.getDefaultInstance()))
          .setSchemaDescriptor(new EmailServiceMethodDescriptorSupplier("sendMerchantEmail"))
          .build();
  @io.grpc.ExperimentalApi("https://github.com/grpc/grpc-java/issues/1901")
  public static final io.grpc.MethodDescriptor<com.ywt.gapi.message.SendErrorEmailRequest,
      com.ywt.gapi.Result> METHOD_SEND_ERROR_EMAIL =
      io.grpc.MethodDescriptor.<com.ywt.gapi.message.SendErrorEmailRequest, com.ywt.gapi.Result>newBuilder()
          .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
          .setFullMethodName(generateFullMethodName(
              "com.ywt.gapi.message.EmailService", "sendErrorEmail"))
          .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.message.SendErrorEmailRequest.getDefaultInstance()))
          .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
              com.ywt.gapi.Result.getDefaultInstance()))
          .setSchemaDescriptor(new EmailServiceMethodDescriptorSupplier("sendErrorEmail"))
          .build();

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

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

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

  /**
   * <pre>
   * 发送邮件服务    // 对应 MsgService 项目的 EmailProvider 类
   * </pre>
   */
  public static abstract class EmailServiceImplBase implements io.grpc.BindableService {

    /**
     * <pre>
     * 发送经销商邮件
     * </pre>
     */
    public void sendMerchantEmail(com.ywt.gapi.message.SendMerchantEmailRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.message.SendMerchantEmailResponse> responseObserver) {
      asyncUnimplementedUnaryCall(METHOD_SEND_MERCHANT_EMAIL, responseObserver);
    }

    /**
     * <pre>
     * 发送邮件，记录出错日志
     * </pre>
     */
    public void sendErrorEmail(com.ywt.gapi.message.SendErrorEmailRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.Result> responseObserver) {
      asyncUnimplementedUnaryCall(METHOD_SEND_ERROR_EMAIL, responseObserver);
    }

    @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
      return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
          .addMethod(
            METHOD_SEND_MERCHANT_EMAIL,
            asyncUnaryCall(
              new MethodHandlers<
                com.ywt.gapi.message.SendMerchantEmailRequest,
                com.ywt.gapi.message.SendMerchantEmailResponse>(
                  this, METHODID_SEND_MERCHANT_EMAIL)))
          .addMethod(
            METHOD_SEND_ERROR_EMAIL,
            asyncUnaryCall(
              new MethodHandlers<
                com.ywt.gapi.message.SendErrorEmailRequest,
                com.ywt.gapi.Result>(
                  this, METHODID_SEND_ERROR_EMAIL)))
          .build();
    }
  }

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

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

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

    /**
     * <pre>
     * 发送经销商邮件
     * </pre>
     */
    public void sendMerchantEmail(com.ywt.gapi.message.SendMerchantEmailRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.message.SendMerchantEmailResponse> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_SEND_MERCHANT_EMAIL, getCallOptions()), request, responseObserver);
    }

    /**
     * <pre>
     * 发送邮件，记录出错日志
     * </pre>
     */
    public void sendErrorEmail(com.ywt.gapi.message.SendErrorEmailRequest request,
        io.grpc.stub.StreamObserver<com.ywt.gapi.Result> responseObserver) {
      asyncUnaryCall(
          getChannel().newCall(METHOD_SEND_ERROR_EMAIL, getCallOptions()), request, responseObserver);
    }
  }

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

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

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

    /**
     * <pre>
     * 发送经销商邮件
     * </pre>
     */
    public com.ywt.gapi.message.SendMerchantEmailResponse sendMerchantEmail(com.ywt.gapi.message.SendMerchantEmailRequest request) {
      return blockingUnaryCall(
          getChannel(), METHOD_SEND_MERCHANT_EMAIL, getCallOptions(), request);
    }

    /**
     * <pre>
     * 发送邮件，记录出错日志
     * </pre>
     */
    public com.ywt.gapi.Result sendErrorEmail(com.ywt.gapi.message.SendErrorEmailRequest request) {
      return blockingUnaryCall(
          getChannel(), METHOD_SEND_ERROR_EMAIL, getCallOptions(), request);
    }
  }

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

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

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

    /**
     * <pre>
     * 发送经销商邮件
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.ywt.gapi.message.SendMerchantEmailResponse> sendMerchantEmail(
        com.ywt.gapi.message.SendMerchantEmailRequest request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_SEND_MERCHANT_EMAIL, getCallOptions()), request);
    }

    /**
     * <pre>
     * 发送邮件，记录出错日志
     * </pre>
     */
    public com.google.common.util.concurrent.ListenableFuture<com.ywt.gapi.Result> sendErrorEmail(
        com.ywt.gapi.message.SendErrorEmailRequest request) {
      return futureUnaryCall(
          getChannel().newCall(METHOD_SEND_ERROR_EMAIL, getCallOptions()), request);
    }
  }

  private static final int METHODID_SEND_MERCHANT_EMAIL = 0;
  private static final int METHODID_SEND_ERROR_EMAIL = 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 EmailServiceImplBase serviceImpl;
    private final int methodId;

    MethodHandlers(EmailServiceImplBase 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_MERCHANT_EMAIL:
          serviceImpl.sendMerchantEmail((com.ywt.gapi.message.SendMerchantEmailRequest) request,
              (io.grpc.stub.StreamObserver<com.ywt.gapi.message.SendMerchantEmailResponse>) responseObserver);
          break;
        case METHODID_SEND_ERROR_EMAIL:
          serviceImpl.sendErrorEmail((com.ywt.gapi.message.SendErrorEmailRequest) 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 EmailServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
    EmailServiceBaseDescriptorSupplier() {}

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

  private static final class EmailServiceFileDescriptorSupplier
      extends EmailServiceBaseDescriptorSupplier {
    EmailServiceFileDescriptorSupplier() {}
  }

  private static final class EmailServiceMethodDescriptorSupplier
      extends EmailServiceBaseDescriptorSupplier
      implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
    private final String methodName;

    EmailServiceMethodDescriptorSupplier(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 (EmailServiceGrpc.class) {
        result = serviceDescriptor;
        if (result == null) {
          serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
              .setSchemaDescriptor(new EmailServiceFileDescriptorSupplier())
              .addMethod(METHOD_SEND_MERCHANT_EMAIL)
              .addMethod(METHOD_SEND_ERROR_EMAIL)
              .build();
        }
      }
    }
    return result;
  }
}
