// 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/ai/tts/v3/tts_service.proto

package tts

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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	Synthesizer_UtteranceSynthesis_FullMethodName = "/speechkit.tts.v3.Synthesizer/UtteranceSynthesis"
	Synthesizer_StreamSynthesis_FullMethodName    = "/speechkit.tts.v3.Synthesizer/StreamSynthesis"
)

// SynthesizerClient is the client API for Synthesizer 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.
//
// A set of methods for voice synthesis.
type SynthesizerClient interface {
	// Synthesizing text into speech.
	UtteranceSynthesis(ctx context.Context, in *UtteranceSynthesisRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[UtteranceSynthesisResponse], error)
	// Bidirectional streaming RPC for real-time synthesis.
	StreamSynthesis(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StreamSynthesisRequest, StreamSynthesisResponse], error)
}

type synthesizerClient struct {
	cc grpc.ClientConnInterface
}

func NewSynthesizerClient(cc grpc.ClientConnInterface) SynthesizerClient {
	return &synthesizerClient{cc}
}

func (c *synthesizerClient) UtteranceSynthesis(ctx context.Context, in *UtteranceSynthesisRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[UtteranceSynthesisResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Synthesizer_ServiceDesc.Streams[0], Synthesizer_UtteranceSynthesis_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[UtteranceSynthesisRequest, UtteranceSynthesisResponse]{ClientStream: stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	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 Synthesizer_UtteranceSynthesisClient = grpc.ServerStreamingClient[UtteranceSynthesisResponse]

func (c *synthesizerClient) StreamSynthesis(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[StreamSynthesisRequest, StreamSynthesisResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Synthesizer_ServiceDesc.Streams[1], Synthesizer_StreamSynthesis_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[StreamSynthesisRequest, StreamSynthesisResponse]{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 Synthesizer_StreamSynthesisClient = grpc.BidiStreamingClient[StreamSynthesisRequest, StreamSynthesisResponse]

// SynthesizerServer is the server API for Synthesizer service.
// All implementations should embed UnimplementedSynthesizerServer
// for forward compatibility.
//
// A set of methods for voice synthesis.
type SynthesizerServer interface {
	// Synthesizing text into speech.
	UtteranceSynthesis(*UtteranceSynthesisRequest, grpc.ServerStreamingServer[UtteranceSynthesisResponse]) error
	// Bidirectional streaming RPC for real-time synthesis.
	StreamSynthesis(grpc.BidiStreamingServer[StreamSynthesisRequest, StreamSynthesisResponse]) error
}

// UnimplementedSynthesizerServer 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 UnimplementedSynthesizerServer struct{}

func (UnimplementedSynthesizerServer) UtteranceSynthesis(*UtteranceSynthesisRequest, grpc.ServerStreamingServer[UtteranceSynthesisResponse]) error {
	return status.Errorf(codes.Unimplemented, "method UtteranceSynthesis not implemented")
}
func (UnimplementedSynthesizerServer) StreamSynthesis(grpc.BidiStreamingServer[StreamSynthesisRequest, StreamSynthesisResponse]) error {
	return status.Errorf(codes.Unimplemented, "method StreamSynthesis not implemented")
}
func (UnimplementedSynthesizerServer) testEmbeddedByValue() {}

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

func RegisterSynthesizerServer(s grpc.ServiceRegistrar, srv SynthesizerServer) {
	// If the following call pancis, it indicates UnimplementedSynthesizerServer 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(&Synthesizer_ServiceDesc, srv)
}

func _Synthesizer_UtteranceSynthesis_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(UtteranceSynthesisRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(SynthesizerServer).UtteranceSynthesis(m, &grpc.GenericServerStream[UtteranceSynthesisRequest, UtteranceSynthesisResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Synthesizer_UtteranceSynthesisServer = grpc.ServerStreamingServer[UtteranceSynthesisResponse]

func _Synthesizer_StreamSynthesis_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(SynthesizerServer).StreamSynthesis(&grpc.GenericServerStream[StreamSynthesisRequest, StreamSynthesisResponse]{ServerStream: stream})
}

// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type Synthesizer_StreamSynthesisServer = grpc.BidiStreamingServer[StreamSynthesisRequest, StreamSynthesisResponse]

// Synthesizer_ServiceDesc is the grpc.ServiceDesc for Synthesizer service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Synthesizer_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "speechkit.tts.v3.Synthesizer",
	HandlerType: (*SynthesizerServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "UtteranceSynthesis",
			Handler:       _Synthesizer_UtteranceSynthesis_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "StreamSynthesis",
			Handler:       _Synthesizer_StreamSynthesis_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "yandex/cloud/ai/tts/v3/tts_service.proto",
}
