// Code generated by thriftrw-plugin-yarpc
// @generated

package workflowservicefx

import (
	fx "go.uber.org/fx"
	transport "go.uber.org/yarpc/api/transport"
	thrift "go.uber.org/yarpc/encoding/thrift"

	workflowserviceserver "github.com/uber/cadence/.gen/go/cadence/workflowserviceserver"
)

// ServerParams defines the dependencies for the WorkflowService server.
type ServerParams struct {
	fx.In

	Handler workflowserviceserver.Interface
}

// ServerResult defines the output of WorkflowService server module. It provides the
// procedures of a WorkflowService handler 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 ServerResult struct {
	fx.Out

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

// Server provides procedures for WorkflowService to an Fx application. It expects a
// workflowservicefx.Interface to be present in the container.
//
//	fx.Provide(
//		func(h *MyWorkflowServiceHandler) workflowserviceserver.Interface {
//			return h
//		},
//		workflowservicefx.Server(),
//	)
func Server(opts ...thrift.RegisterOption) interface{} {
	return func(p ServerParams) ServerResult {
		procedures := workflowserviceserver.New(p.Handler, opts...)
		return ServerResult{Procedures: procedures}
	}
}
