// Code generated by protoc-gen-go-grpc. DO NOT EDIT.

package tofnd

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
)

// 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

// GG20Client is the client API for GG20 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 GG20Client interface {
	Recover(ctx context.Context, in *RecoverRequest, opts ...grpc.CallOption) (*RecoverResponse, error)
	Keygen(ctx context.Context, opts ...grpc.CallOption) (GG20_KeygenClient, error)
	Sign(ctx context.Context, opts ...grpc.CallOption) (GG20_SignClient, error)
	KeyPresence(ctx context.Context, in *KeyPresenceRequest, opts ...grpc.CallOption) (*KeyPresenceResponse, error)
}

type gG20Client struct {
	cc grpc.ClientConnInterface
}

func NewGG20Client(cc grpc.ClientConnInterface) GG20Client {
	return &gG20Client{cc}
}

func (c *gG20Client) Recover(ctx context.Context, in *RecoverRequest, opts ...grpc.CallOption) (*RecoverResponse, error) {
	out := new(RecoverResponse)
	err := c.cc.Invoke(ctx, "/tofnd.GG20/Recover", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *gG20Client) Keygen(ctx context.Context, opts ...grpc.CallOption) (GG20_KeygenClient, error) {
	stream, err := c.cc.NewStream(ctx, &GG20_ServiceDesc.Streams[0], "/tofnd.GG20/Keygen", opts...)
	if err != nil {
		return nil, err
	}
	x := &gG20KeygenClient{stream}
	return x, nil
}

type GG20_KeygenClient interface {
	Send(*MessageIn) error
	Recv() (*MessageOut, error)
	grpc.ClientStream
}

type gG20KeygenClient struct {
	grpc.ClientStream
}

func (x *gG20KeygenClient) Send(m *MessageIn) error {
	return x.ClientStream.SendMsg(m)
}

func (x *gG20KeygenClient) Recv() (*MessageOut, error) {
	m := new(MessageOut)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *gG20Client) Sign(ctx context.Context, opts ...grpc.CallOption) (GG20_SignClient, error) {
	stream, err := c.cc.NewStream(ctx, &GG20_ServiceDesc.Streams[1], "/tofnd.GG20/Sign", opts...)
	if err != nil {
		return nil, err
	}
	x := &gG20SignClient{stream}
	return x, nil
}

type GG20_SignClient interface {
	Send(*MessageIn) error
	Recv() (*MessageOut, error)
	grpc.ClientStream
}

type gG20SignClient struct {
	grpc.ClientStream
}

func (x *gG20SignClient) Send(m *MessageIn) error {
	return x.ClientStream.SendMsg(m)
}

func (x *gG20SignClient) Recv() (*MessageOut, error) {
	m := new(MessageOut)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *gG20Client) KeyPresence(ctx context.Context, in *KeyPresenceRequest, opts ...grpc.CallOption) (*KeyPresenceResponse, error) {
	out := new(KeyPresenceResponse)
	err := c.cc.Invoke(ctx, "/tofnd.GG20/KeyPresence", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// GG20Server is the server API for GG20 service.
// All implementations must embed UnimplementedGG20Server
// for forward compatibility
type GG20Server interface {
	Recover(context.Context, *RecoverRequest) (*RecoverResponse, error)
	Keygen(GG20_KeygenServer) error
	Sign(GG20_SignServer) error
	KeyPresence(context.Context, *KeyPresenceRequest) (*KeyPresenceResponse, error)
	mustEmbedUnimplementedGG20Server()
}

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

func (UnimplementedGG20Server) Recover(context.Context, *RecoverRequest) (*RecoverResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Recover not implemented")
}
func (UnimplementedGG20Server) Keygen(GG20_KeygenServer) error {
	return status.Errorf(codes.Unimplemented, "method Keygen not implemented")
}
func (UnimplementedGG20Server) Sign(GG20_SignServer) error {
	return status.Errorf(codes.Unimplemented, "method Sign not implemented")
}
func (UnimplementedGG20Server) KeyPresence(context.Context, *KeyPresenceRequest) (*KeyPresenceResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method KeyPresence not implemented")
}
func (UnimplementedGG20Server) mustEmbedUnimplementedGG20Server() {}

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

func RegisterGG20Server(s grpc.ServiceRegistrar, srv GG20Server) {
	s.RegisterService(&GG20_ServiceDesc, srv)
}

func _GG20_Recover_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(RecoverRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(GG20Server).Recover(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/tofnd.GG20/Recover",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(GG20Server).Recover(ctx, req.(*RecoverRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _GG20_Keygen_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(GG20Server).Keygen(&gG20KeygenServer{stream})
}

type GG20_KeygenServer interface {
	Send(*MessageOut) error
	Recv() (*MessageIn, error)
	grpc.ServerStream
}

type gG20KeygenServer struct {
	grpc.ServerStream
}

func (x *gG20KeygenServer) Send(m *MessageOut) error {
	return x.ServerStream.SendMsg(m)
}

func (x *gG20KeygenServer) Recv() (*MessageIn, error) {
	m := new(MessageIn)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _GG20_Sign_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(GG20Server).Sign(&gG20SignServer{stream})
}

type GG20_SignServer interface {
	Send(*MessageOut) error
	Recv() (*MessageIn, error)
	grpc.ServerStream
}

type gG20SignServer struct {
	grpc.ServerStream
}

func (x *gG20SignServer) Send(m *MessageOut) error {
	return x.ServerStream.SendMsg(m)
}

func (x *gG20SignServer) Recv() (*MessageIn, error) {
	m := new(MessageIn)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _GG20_KeyPresence_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(KeyPresenceRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(GG20Server).KeyPresence(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/tofnd.GG20/KeyPresence",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(GG20Server).KeyPresence(ctx, req.(*KeyPresenceRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// GG20_ServiceDesc is the grpc.ServiceDesc for GG20 service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var GG20_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "tofnd.GG20",
	HandlerType: (*GG20Server)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Recover",
			Handler:    _GG20_Recover_Handler,
		},
		{
			MethodName: "KeyPresence",
			Handler:    _GG20_KeyPresence_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Keygen",
			Handler:       _GG20_Keygen_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "Sign",
			Handler:       _GG20_Sign_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "tss/tofnd/tofnd.proto",
}
