// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v6.31.1
// source: yandexmarket/products.proto

package products

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 (
	ProductsService_CalculateProductTariffs_FullMethodName = "/yandexmarket.products.ProductsService/CalculateProductTariffs"
	ProductsService_GetProducts_FullMethodName             = "/yandexmarket.products.ProductsService/GetProducts"
)

// ProductsServiceClient is the client API for ProductsService 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 ProductsServiceClient interface {
	CalculateProductTariffs(ctx context.Context, in *CalculateProductTariffsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CalculateProductTariffsResponse], error)
	GetProducts(ctx context.Context, in *GetProductsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetProductsResponse], error)
}

type productsServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewProductsServiceClient(cc grpc.ClientConnInterface) ProductsServiceClient {
	return &productsServiceClient{cc}
}

func (c *productsServiceClient) CalculateProductTariffs(ctx context.Context, in *CalculateProductTariffsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[CalculateProductTariffsResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ProductsService_ServiceDesc.Streams[0], ProductsService_CalculateProductTariffs_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[CalculateProductTariffsRequest, CalculateProductTariffsResponse]{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 ProductsService_CalculateProductTariffsClient = grpc.ServerStreamingClient[CalculateProductTariffsResponse]

func (c *productsServiceClient) GetProducts(ctx context.Context, in *GetProductsRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[GetProductsResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ProductsService_ServiceDesc.Streams[1], ProductsService_GetProducts_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[GetProductsRequest, GetProductsResponse]{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 ProductsService_GetProductsClient = grpc.ServerStreamingClient[GetProductsResponse]

// ProductsServiceServer is the server API for ProductsService service.
// All implementations must embed UnimplementedProductsServiceServer
// for forward compatibility.
type ProductsServiceServer interface {
	CalculateProductTariffs(*CalculateProductTariffsRequest, grpc.ServerStreamingServer[CalculateProductTariffsResponse]) error
	GetProducts(*GetProductsRequest, grpc.ServerStreamingServer[GetProductsResponse]) error
	mustEmbedUnimplementedProductsServiceServer()
}

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

func (UnimplementedProductsServiceServer) CalculateProductTariffs(*CalculateProductTariffsRequest, grpc.ServerStreamingServer[CalculateProductTariffsResponse]) error {
	return status.Errorf(codes.Unimplemented, "method CalculateProductTariffs not implemented")
}
func (UnimplementedProductsServiceServer) GetProducts(*GetProductsRequest, grpc.ServerStreamingServer[GetProductsResponse]) error {
	return status.Errorf(codes.Unimplemented, "method GetProducts not implemented")
}
func (UnimplementedProductsServiceServer) mustEmbedUnimplementedProductsServiceServer() {}
func (UnimplementedProductsServiceServer) testEmbeddedByValue()                         {}

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

func RegisterProductsServiceServer(s grpc.ServiceRegistrar, srv ProductsServiceServer) {
	// If the following call pancis, it indicates UnimplementedProductsServiceServer 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(&ProductsService_ServiceDesc, srv)
}

func _ProductsService_CalculateProductTariffs_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(CalculateProductTariffsRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ProductsServiceServer).CalculateProductTariffs(m, &grpc.GenericServerStream[CalculateProductTariffsRequest, CalculateProductTariffsResponse]{ServerStream: stream})
}

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

func _ProductsService_GetProducts_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(GetProductsRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ProductsServiceServer).GetProducts(m, &grpc.GenericServerStream[GetProductsRequest, GetProductsResponse]{ServerStream: stream})
}

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

// ProductsService_ServiceDesc is the grpc.ServiceDesc for ProductsService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ProductsService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "yandexmarket.products.ProductsService",
	HandlerType: (*ProductsServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "CalculateProductTariffs",
			Handler:       _ProductsService_CalculateProductTariffs_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "GetProducts",
			Handler:       _ProductsService_GetProducts_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "yandexmarket/products.proto",
}
