// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             (unknown)
// source: node/v1/engine.proto

package nodev1

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

// EngineClient is the client API for Engine service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type EngineClient interface {
	// NewPayload generate a new execution payload.
	NewPayload(ctx context.Context, in *PayloadParams, opts ...grpc.CallOption) (*ExecutionPayload, error)
	// ProcessPayload execute a new execute payload that received from other node.
	ProcessPayload(ctx context.Context, in *ExecutionPayload, opts ...grpc.CallOption) (*emptypb.Empty, error)
}

type engineClient struct {
	cc grpc.ClientConnInterface
}

func NewEngineClient(cc grpc.ClientConnInterface) EngineClient {
	return &engineClient{cc}
}

func (c *engineClient) NewPayload(ctx context.Context, in *PayloadParams, opts ...grpc.CallOption) (*ExecutionPayload, error) {
	out := new(ExecutionPayload)
	err := c.cc.Invoke(ctx, "/exchain.node.v1.Engine/NewPayload", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *engineClient) ProcessPayload(ctx context.Context, in *ExecutionPayload, opts ...grpc.CallOption) (*emptypb.Empty, error) {
	out := new(emptypb.Empty)
	err := c.cc.Invoke(ctx, "/exchain.node.v1.Engine/ProcessPayload", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// EngineServer is the server API for Engine service.
// All implementations must embed UnimplementedEngineServer
// for forward compatibility
type EngineServer interface {
	// NewPayload generate a new execution payload.
	NewPayload(context.Context, *PayloadParams) (*ExecutionPayload, error)
	// ProcessPayload execute a new execute payload that received from other node.
	ProcessPayload(context.Context, *ExecutionPayload) (*emptypb.Empty, error)
	mustEmbedUnimplementedEngineServer()
}

// UnimplementedEngineServer must be embedded to have forward compatible implementations.
type UnimplementedEngineServer struct {
}

func (UnimplementedEngineServer) NewPayload(context.Context, *PayloadParams) (*ExecutionPayload, error) {
	return nil, status.Errorf(codes.Unimplemented, "method NewPayload not implemented")
}
func (UnimplementedEngineServer) ProcessPayload(context.Context, *ExecutionPayload) (*emptypb.Empty, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ProcessPayload not implemented")
}
func (UnimplementedEngineServer) mustEmbedUnimplementedEngineServer() {}

// UnsafeEngineServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to EngineServer will
// result in compilation errors.
type UnsafeEngineServer interface {
	mustEmbedUnimplementedEngineServer()
}

func RegisterEngineServer(s grpc.ServiceRegistrar, srv EngineServer) {
	s.RegisterService(&Engine_ServiceDesc, srv)
}

func _Engine_NewPayload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PayloadParams)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EngineServer).NewPayload(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/exchain.node.v1.Engine/NewPayload",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EngineServer).NewPayload(ctx, req.(*PayloadParams))
	}
	return interceptor(ctx, in, info, handler)
}

func _Engine_ProcessPayload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ExecutionPayload)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EngineServer).ProcessPayload(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/exchain.node.v1.Engine/ProcessPayload",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EngineServer).ProcessPayload(ctx, req.(*ExecutionPayload))
	}
	return interceptor(ctx, in, info, handler)
}

// Engine_ServiceDesc is the grpc.ServiceDesc for Engine service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Engine_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "exchain.node.v1.Engine",
	HandlerType: (*EngineServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "NewPayload",
			Handler:    _Engine_NewPayload_Handler,
		},
		{
			MethodName: "ProcessPayload",
			Handler:    _Engine_ProcessPayload_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "node/v1/engine.proto",
}
