// Code generated by protoc-gen-yarpc-go. DO NOT EDIT.
// source: uber/cadence/sharddistributor/v1/executor.proto

package sharddistributorv1

import (
	"context"
	"io/ioutil"
	"reflect"

	"github.com/gogo/protobuf/jsonpb"
	"github.com/gogo/protobuf/proto"
	"go.uber.org/fx"
	"go.uber.org/yarpc"
	"go.uber.org/yarpc/api/transport"
	"go.uber.org/yarpc/api/x/restriction"
	"go.uber.org/yarpc/encoding/protobuf"
	"go.uber.org/yarpc/encoding/protobuf/reflection"
)

var _ = ioutil.NopCloser

// ShardDistributorExecutorAPIYARPCClient is the YARPC client-side interface for the ShardDistributorExecutorAPI service.
type ShardDistributorExecutorAPIYARPCClient interface {
	Heartbeat(context.Context, *HeartbeatRequest, ...yarpc.CallOption) (*HeartbeatResponse, error)
}

func newShardDistributorExecutorAPIYARPCClient(clientConfig transport.ClientConfig, anyResolver jsonpb.AnyResolver, options ...protobuf.ClientOption) ShardDistributorExecutorAPIYARPCClient {
	return &_ShardDistributorExecutorAPIYARPCCaller{protobuf.NewStreamClient(
		protobuf.ClientParams{
			ServiceName:  "uber.cadence.sharddistributor.v1.ShardDistributorExecutorAPI",
			ClientConfig: clientConfig,
			AnyResolver:  anyResolver,
			Options:      options,
		},
	)}
}

// NewShardDistributorExecutorAPIYARPCClient builds a new YARPC client for the ShardDistributorExecutorAPI service.
func NewShardDistributorExecutorAPIYARPCClient(clientConfig transport.ClientConfig, options ...protobuf.ClientOption) ShardDistributorExecutorAPIYARPCClient {
	return newShardDistributorExecutorAPIYARPCClient(clientConfig, nil, options...)
}

// ShardDistributorExecutorAPIYARPCServer is the YARPC server-side interface for the ShardDistributorExecutorAPI service.
type ShardDistributorExecutorAPIYARPCServer interface {
	Heartbeat(context.Context, *HeartbeatRequest) (*HeartbeatResponse, error)
}

type buildShardDistributorExecutorAPIYARPCProceduresParams struct {
	Server      ShardDistributorExecutorAPIYARPCServer
	AnyResolver jsonpb.AnyResolver
}

func buildShardDistributorExecutorAPIYARPCProcedures(params buildShardDistributorExecutorAPIYARPCProceduresParams) []transport.Procedure {
	handler := &_ShardDistributorExecutorAPIYARPCHandler{params.Server}
	return protobuf.BuildProcedures(
		protobuf.BuildProceduresParams{
			ServiceName: "uber.cadence.sharddistributor.v1.ShardDistributorExecutorAPI",
			UnaryHandlerParams: []protobuf.BuildProceduresUnaryHandlerParams{
				{
					MethodName: "Heartbeat",
					Handler: protobuf.NewUnaryHandler(
						protobuf.UnaryHandlerParams{
							Handle:      handler.Heartbeat,
							NewRequest:  newShardDistributorExecutorAPIServiceHeartbeatYARPCRequest,
							AnyResolver: params.AnyResolver,
						},
					),
				},
			},
			OnewayHandlerParams: []protobuf.BuildProceduresOnewayHandlerParams{},
			StreamHandlerParams: []protobuf.BuildProceduresStreamHandlerParams{},
		},
	)
}

// BuildShardDistributorExecutorAPIYARPCProcedures prepares an implementation of the ShardDistributorExecutorAPI service for YARPC registration.
func BuildShardDistributorExecutorAPIYARPCProcedures(server ShardDistributorExecutorAPIYARPCServer) []transport.Procedure {
	return buildShardDistributorExecutorAPIYARPCProcedures(buildShardDistributorExecutorAPIYARPCProceduresParams{Server: server})
}

// FxShardDistributorExecutorAPIYARPCClientParams defines the input
// for NewFxShardDistributorExecutorAPIYARPCClient. It provides the
// paramaters to get a ShardDistributorExecutorAPIYARPCClient in an
// Fx application.
type FxShardDistributorExecutorAPIYARPCClientParams struct {
	fx.In

	Provider    yarpc.ClientConfig
	AnyResolver jsonpb.AnyResolver  `name:"yarpcfx" optional:"true"`
	Restriction restriction.Checker `optional:"true"`
}

// FxShardDistributorExecutorAPIYARPCClientResult defines the output
// of NewFxShardDistributorExecutorAPIYARPCClient. It provides a
// ShardDistributorExecutorAPIYARPCClient to an Fx application.
type FxShardDistributorExecutorAPIYARPCClientResult struct {
	fx.Out

	Client ShardDistributorExecutorAPIYARPCClient

	// We are using an fx.Out struct here instead of just returning a client
	// so that we can add more values or add named versions of the client in
	// the future without breaking any existing code.
}

// NewFxShardDistributorExecutorAPIYARPCClient provides a ShardDistributorExecutorAPIYARPCClient
// to an Fx application using the given name for routing.
//
//	fx.Provide(
//	  sharddistributorv1.NewFxShardDistributorExecutorAPIYARPCClient("service-name"),
//	  ...
//	)
func NewFxShardDistributorExecutorAPIYARPCClient(name string, options ...protobuf.ClientOption) interface{} {
	return func(params FxShardDistributorExecutorAPIYARPCClientParams) FxShardDistributorExecutorAPIYARPCClientResult {
		cc := params.Provider.ClientConfig(name)

		if params.Restriction != nil {
			if namer, ok := cc.GetUnaryOutbound().(transport.Namer); ok {
				if err := params.Restriction.Check(protobuf.Encoding, namer.TransportName()); err != nil {
					panic(err.Error())
				}
			}
		}

		return FxShardDistributorExecutorAPIYARPCClientResult{
			Client: newShardDistributorExecutorAPIYARPCClient(cc, params.AnyResolver, options...),
		}
	}
}

// FxShardDistributorExecutorAPIYARPCProceduresParams defines the input
// for NewFxShardDistributorExecutorAPIYARPCProcedures. It provides the
// paramaters to get ShardDistributorExecutorAPIYARPCServer procedures in an
// Fx application.
type FxShardDistributorExecutorAPIYARPCProceduresParams struct {
	fx.In

	Server      ShardDistributorExecutorAPIYARPCServer
	AnyResolver jsonpb.AnyResolver `name:"yarpcfx" optional:"true"`
}

// FxShardDistributorExecutorAPIYARPCProceduresResult defines the output
// of NewFxShardDistributorExecutorAPIYARPCProcedures. It provides
// ShardDistributorExecutorAPIYARPCServer procedures to an Fx application.
//
// The procedures are provided to the "yarpcfx" value group.
// Dig 1.2 or newer must be used for this feature to work.
type FxShardDistributorExecutorAPIYARPCProceduresResult struct {
	fx.Out

	Procedures     []transport.Procedure `group:"yarpcfx"`
	ReflectionMeta reflection.ServerMeta `group:"yarpcfx"`
}

// NewFxShardDistributorExecutorAPIYARPCProcedures provides ShardDistributorExecutorAPIYARPCServer procedures to an Fx application.
// It expects a ShardDistributorExecutorAPIYARPCServer to be present in the container.
//
//	fx.Provide(
//	  sharddistributorv1.NewFxShardDistributorExecutorAPIYARPCProcedures(),
//	  ...
//	)
func NewFxShardDistributorExecutorAPIYARPCProcedures() interface{} {
	return func(params FxShardDistributorExecutorAPIYARPCProceduresParams) FxShardDistributorExecutorAPIYARPCProceduresResult {
		return FxShardDistributorExecutorAPIYARPCProceduresResult{
			Procedures: buildShardDistributorExecutorAPIYARPCProcedures(buildShardDistributorExecutorAPIYARPCProceduresParams{
				Server:      params.Server,
				AnyResolver: params.AnyResolver,
			}),
			ReflectionMeta: ShardDistributorExecutorAPIReflectionMeta,
		}
	}
}

// ShardDistributorExecutorAPIReflectionMeta is the reflection server metadata
// required for using the gRPC reflection protocol with YARPC.
//
// See https://github.com/grpc/grpc/blob/master/doc/server-reflection.md.
var ShardDistributorExecutorAPIReflectionMeta = reflection.ServerMeta{
	ServiceName:     "uber.cadence.sharddistributor.v1.ShardDistributorExecutorAPI",
	FileDescriptors: yarpcFileDescriptorClosure5aab034437d08cca,
}

type _ShardDistributorExecutorAPIYARPCCaller struct {
	streamClient protobuf.StreamClient
}

func (c *_ShardDistributorExecutorAPIYARPCCaller) Heartbeat(ctx context.Context, request *HeartbeatRequest, options ...yarpc.CallOption) (*HeartbeatResponse, error) {
	responseMessage, err := c.streamClient.Call(ctx, "Heartbeat", request, newShardDistributorExecutorAPIServiceHeartbeatYARPCResponse, options...)
	if responseMessage == nil {
		return nil, err
	}
	response, ok := responseMessage.(*HeartbeatResponse)
	if !ok {
		return nil, protobuf.CastError(emptyShardDistributorExecutorAPIServiceHeartbeatYARPCResponse, responseMessage)
	}
	return response, err
}

type _ShardDistributorExecutorAPIYARPCHandler struct {
	server ShardDistributorExecutorAPIYARPCServer
}

func (h *_ShardDistributorExecutorAPIYARPCHandler) Heartbeat(ctx context.Context, requestMessage proto.Message) (proto.Message, error) {
	var request *HeartbeatRequest
	var ok bool
	if requestMessage != nil {
		request, ok = requestMessage.(*HeartbeatRequest)
		if !ok {
			return nil, protobuf.CastError(emptyShardDistributorExecutorAPIServiceHeartbeatYARPCRequest, requestMessage)
		}
	}
	response, err := h.server.Heartbeat(ctx, request)
	if response == nil {
		return nil, err
	}
	return response, err
}

func newShardDistributorExecutorAPIServiceHeartbeatYARPCRequest() proto.Message {
	return &HeartbeatRequest{}
}

func newShardDistributorExecutorAPIServiceHeartbeatYARPCResponse() proto.Message {
	return &HeartbeatResponse{}
}

var (
	emptyShardDistributorExecutorAPIServiceHeartbeatYARPCRequest  = &HeartbeatRequest{}
	emptyShardDistributorExecutorAPIServiceHeartbeatYARPCResponse = &HeartbeatResponse{}
)

var yarpcFileDescriptorClosure5aab034437d08cca = [][]byte{
	// uber/cadence/sharddistributor/v1/executor.proto
	[]byte{
		0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x55, 0xdb, 0x6e, 0xda, 0x4a,
		0x14, 0x3d, 0x86, 0x9c, 0x48, 0x6c, 0x14, 0x8e, 0x19, 0xe5, 0xc2, 0x21, 0x89, 0x8a, 0xa2, 0xaa,
		0x8d, 0xa8, 0x6a, 0x0a, 0x79, 0xa9, 0xda, 0xa7, 0x49, 0x6c, 0xc1, 0xa4, 0x60, 0x47, 0x63, 0x43,
		0x2f, 0x52, 0x65, 0x19, 0x3c, 0x22, 0x56, 0x83, 0x4d, 0xed, 0x01, 0x35, 0x55, 0x1f, 0xfb, 0x07,
		0x55, 0xff, 0xa9, 0xff, 0xd0, 0x9f, 0xa9, 0x6c, 0x43, 0xc0, 0x86, 0x8a, 0xa6, 0x6f, 0xf6, 0x5e,
		0x7b, 0xad, 0x3d, 0x5e, 0x6b, 0xc6, 0x03, 0xb5, 0x49, 0x9f, 0xf9, 0xb5, 0x81, 0x65, 0x33, 0x77,
		0xc0, 0x6a, 0xc1, 0xb5, 0xe5, 0xdb, 0xb6, 0x13, 0x70, 0xdf, 0xe9, 0x4f, 0xb8, 0xe7, 0xd7, 0xa6,
		0xf5, 0x1a, 0xfb, 0xc4, 0x06, 0xe1, 0xb3, 0x34, 0xf6, 0x3d, 0xee, 0xa1, 0x4a, 0x48, 0x90, 0x66,
		0x04, 0x29, 0x4d, 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x7a, 0x7f, 0x3b, 0xea, 0x3e, 0xfb, 0x15, 0x00, 0x00,
		0xff, 0xff, 0xa7, 0x93, 0xad, 0x22, 0x08, 0x07, 0x00, 0x00,
	},
}

func init() {
	yarpc.RegisterClientBuilder(
		func(clientConfig transport.ClientConfig, structField reflect.StructField) ShardDistributorExecutorAPIYARPCClient {
			return NewShardDistributorExecutorAPIYARPCClient(clientConfig, protobuf.ClientBuilderOptions(clientConfig, structField)...)
		},
	)
}
