// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v3.21.12
// source: yandex/cloud/speechsense/v1/talk_service.proto

package speechsense

import (
	context "context"
	operation "github.com/yandex-cloud/go-genproto/yandex/cloud/operation"
	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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	TalkService_UploadAsStream_FullMethodName = "/yandex.cloud.speechsense.v1.TalkService/UploadAsStream"
	TalkService_Upload_FullMethodName         = "/yandex.cloud.speechsense.v1.TalkService/Upload"
	TalkService_UploadText_FullMethodName     = "/yandex.cloud.speechsense.v1.TalkService/UploadText"
	TalkService_UploadBadge_FullMethodName    = "/yandex.cloud.speechsense.v1.TalkService/UploadBadge"
	TalkService_Search_FullMethodName         = "/yandex.cloud.speechsense.v1.TalkService/Search"
	TalkService_Get_FullMethodName            = "/yandex.cloud.speechsense.v1.TalkService/Get"
)

// TalkServiceClient is the client API for TalkService 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 TalkServiceClient interface {
	// rpc for streaming talk documents. First message should contain Talk related metadata,
	// second - audio metadata, others should contain audio bytes in chunks
	UploadAsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[StreamTalkRequest, UploadTalkResponse], error)
	// rpc for uploading talk document as single message
	Upload(ctx context.Context, in *UploadTalkRequest, opts ...grpc.CallOption) (*UploadTalkResponse, error)
	// rpc for uploading text talk document
	UploadText(ctx context.Context, in *UploadTextRequest, opts ...grpc.CallOption) (*UploadTextResponse, error)
	// rpc for streaming document that contains combined talks. First message should contain Talk related metadata,
	// second - audio metadata, others should contain audio bytes in chunks
	UploadBadge(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[StreamTalkRequest, operation.Operation], error)
	// rpc for searching talks. will return ids only
	Search(ctx context.Context, in *SearchTalkRequest, opts ...grpc.CallOption) (*SearchTalkResponse, error)
	// rpc for bulk get
	Get(ctx context.Context, in *GetTalkRequest, opts ...grpc.CallOption) (*GetTalkResponse, error)
}

type talkServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewTalkServiceClient(cc grpc.ClientConnInterface) TalkServiceClient {
	return &talkServiceClient{cc}
}

func (c *talkServiceClient) UploadAsStream(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[StreamTalkRequest, UploadTalkResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &TalkService_ServiceDesc.Streams[0], TalkService_UploadAsStream_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[StreamTalkRequest, UploadTalkResponse]{ClientStream: stream}
	return x, nil
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TalkService_UploadAsStreamClient = grpc.ClientStreamingClient[StreamTalkRequest, UploadTalkResponse]

func (c *talkServiceClient) Upload(ctx context.Context, in *UploadTalkRequest, opts ...grpc.CallOption) (*UploadTalkResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(UploadTalkResponse)
	err := c.cc.Invoke(ctx, TalkService_Upload_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *talkServiceClient) UploadText(ctx context.Context, in *UploadTextRequest, opts ...grpc.CallOption) (*UploadTextResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(UploadTextResponse)
	err := c.cc.Invoke(ctx, TalkService_UploadText_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *talkServiceClient) UploadBadge(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[StreamTalkRequest, operation.Operation], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &TalkService_ServiceDesc.Streams[1], TalkService_UploadBadge_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[StreamTalkRequest, operation.Operation]{ClientStream: stream}
	return x, nil
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TalkService_UploadBadgeClient = grpc.ClientStreamingClient[StreamTalkRequest, operation.Operation]

func (c *talkServiceClient) Search(ctx context.Context, in *SearchTalkRequest, opts ...grpc.CallOption) (*SearchTalkResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(SearchTalkResponse)
	err := c.cc.Invoke(ctx, TalkService_Search_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *talkServiceClient) Get(ctx context.Context, in *GetTalkRequest, opts ...grpc.CallOption) (*GetTalkResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetTalkResponse)
	err := c.cc.Invoke(ctx, TalkService_Get_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// TalkServiceServer is the server API for TalkService service.
// All implementations should embed UnimplementedTalkServiceServer
// for forward compatibility.
type TalkServiceServer interface {
	// rpc for streaming talk documents. First message should contain Talk related metadata,
	// second - audio metadata, others should contain audio bytes in chunks
	UploadAsStream(grpc.ClientStreamingServer[StreamTalkRequest, UploadTalkResponse]) error
	// rpc for uploading talk document as single message
	Upload(context.Context, *UploadTalkRequest) (*UploadTalkResponse, error)
	// rpc for uploading text talk document
	UploadText(context.Context, *UploadTextRequest) (*UploadTextResponse, error)
	// rpc for streaming document that contains combined talks. First message should contain Talk related metadata,
	// second - audio metadata, others should contain audio bytes in chunks
	UploadBadge(grpc.ClientStreamingServer[StreamTalkRequest, operation.Operation]) error
	// rpc for searching talks. will return ids only
	Search(context.Context, *SearchTalkRequest) (*SearchTalkResponse, error)
	// rpc for bulk get
	Get(context.Context, *GetTalkRequest) (*GetTalkResponse, error)
}

// UnimplementedTalkServiceServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedTalkServiceServer struct{}

func (UnimplementedTalkServiceServer) UploadAsStream(grpc.ClientStreamingServer[StreamTalkRequest, UploadTalkResponse]) error {
	return status.Errorf(codes.Unimplemented, "method UploadAsStream not implemented")
}
func (UnimplementedTalkServiceServer) Upload(context.Context, *UploadTalkRequest) (*UploadTalkResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Upload not implemented")
}
func (UnimplementedTalkServiceServer) UploadText(context.Context, *UploadTextRequest) (*UploadTextResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method UploadText not implemented")
}
func (UnimplementedTalkServiceServer) UploadBadge(grpc.ClientStreamingServer[StreamTalkRequest, operation.Operation]) error {
	return status.Errorf(codes.Unimplemented, "method UploadBadge not implemented")
}
func (UnimplementedTalkServiceServer) Search(context.Context, *SearchTalkRequest) (*SearchTalkResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
}
func (UnimplementedTalkServiceServer) Get(context.Context, *GetTalkRequest) (*GetTalkResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedTalkServiceServer) testEmbeddedByValue() {}

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

func RegisterTalkServiceServer(s grpc.ServiceRegistrar, srv TalkServiceServer) {
	// If the following call pancis, it indicates UnimplementedTalkServiceServer was
	// embedded by pointer and is nil.  This will cause panics if an
	// unimplemented method is ever invoked, so we test this at initialization
	// time to prevent it from happening at runtime later due to I/O.
	if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
		t.testEmbeddedByValue()
	}
	s.RegisterService(&TalkService_ServiceDesc, srv)
}

func _TalkService_UploadAsStream_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(TalkServiceServer).UploadAsStream(&grpc.GenericServerStream[StreamTalkRequest, UploadTalkResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TalkService_UploadAsStreamServer = grpc.ClientStreamingServer[StreamTalkRequest, UploadTalkResponse]

func _TalkService_Upload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(UploadTalkRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TalkServiceServer).Upload(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TalkService_Upload_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TalkServiceServer).Upload(ctx, req.(*UploadTalkRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _TalkService_UploadText_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(UploadTextRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TalkServiceServer).UploadText(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TalkService_UploadText_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TalkServiceServer).UploadText(ctx, req.(*UploadTextRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _TalkService_UploadBadge_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(TalkServiceServer).UploadBadge(&grpc.GenericServerStream[StreamTalkRequest, operation.Operation]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type TalkService_UploadBadgeServer = grpc.ClientStreamingServer[StreamTalkRequest, operation.Operation]

func _TalkService_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SearchTalkRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TalkServiceServer).Search(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TalkService_Search_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TalkServiceServer).Search(ctx, req.(*SearchTalkRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _TalkService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetTalkRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(TalkServiceServer).Get(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: TalkService_Get_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(TalkServiceServer).Get(ctx, req.(*GetTalkRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// TalkService_ServiceDesc is the grpc.ServiceDesc for TalkService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var TalkService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandex.cloud.speechsense.v1.TalkService",
	HandlerType: (*TalkServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Upload",
			Handler:    _TalkService_Upload_Handler,
		},
		{
			MethodName: "UploadText",
			Handler:    _TalkService_UploadText_Handler,
		},
		{
			MethodName: "Search",
			Handler:    _TalkService_Search_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _TalkService_Get_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "UploadAsStream",
			Handler:       _TalkService_UploadAsStream_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "UploadBadge",
			Handler:       _TalkService_UploadBadge_Handler,
			ClientStreams: true,
		},
	},
	Metadata: "yandex/cloud/speechsense/v1/talk_service.proto",
}
