// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             v5.29.3
// source: spark_tree.proto

package spark_tree

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 (
	SparkTreeService_GetLeafDenominationCounts_FullMethodName = "/spark.SparkTreeService/get_leaf_denomination_counts"
	SparkTreeService_FetchPolarityScores_FullMethodName       = "/spark.SparkTreeService/fetch_polarity_scores"
)

// SparkTreeServiceClient is the client API for SparkTreeService 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 SparkTreeServiceClient interface {
	GetLeafDenominationCounts(ctx context.Context, in *GetLeafDenominationCountsRequest, opts ...grpc.CallOption) (*GetLeafDenominationCountsResponse, error)
	FetchPolarityScores(ctx context.Context, in *FetchPolarityScoreRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[PolarityScore], error)
}

type sparkTreeServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewSparkTreeServiceClient(cc grpc.ClientConnInterface) SparkTreeServiceClient {
	return &sparkTreeServiceClient{cc}
}

func (c *sparkTreeServiceClient) GetLeafDenominationCounts(ctx context.Context, in *GetLeafDenominationCountsRequest, opts ...grpc.CallOption) (*GetLeafDenominationCountsResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(GetLeafDenominationCountsResponse)
	err := c.cc.Invoke(ctx, SparkTreeService_GetLeafDenominationCounts_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *sparkTreeServiceClient) FetchPolarityScores(ctx context.Context, in *FetchPolarityScoreRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[PolarityScore], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &SparkTreeService_ServiceDesc.Streams[0], SparkTreeService_FetchPolarityScores_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[FetchPolarityScoreRequest, PolarityScore]{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 SparkTreeService_FetchPolarityScoresClient = grpc.ServerStreamingClient[PolarityScore]

// SparkTreeServiceServer is the server API for SparkTreeService service.
// All implementations must embed UnimplementedSparkTreeServiceServer
// for forward compatibility.
type SparkTreeServiceServer interface {
	GetLeafDenominationCounts(context.Context, *GetLeafDenominationCountsRequest) (*GetLeafDenominationCountsResponse, error)
	FetchPolarityScores(*FetchPolarityScoreRequest, grpc.ServerStreamingServer[PolarityScore]) error
	mustEmbedUnimplementedSparkTreeServiceServer()
}

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

func (UnimplementedSparkTreeServiceServer) GetLeafDenominationCounts(context.Context, *GetLeafDenominationCountsRequest) (*GetLeafDenominationCountsResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method GetLeafDenominationCounts not implemented")
}
func (UnimplementedSparkTreeServiceServer) FetchPolarityScores(*FetchPolarityScoreRequest, grpc.ServerStreamingServer[PolarityScore]) error {
	return status.Errorf(codes.Unimplemented, "method FetchPolarityScores not implemented")
}
func (UnimplementedSparkTreeServiceServer) mustEmbedUnimplementedSparkTreeServiceServer() {}
func (UnimplementedSparkTreeServiceServer) testEmbeddedByValue()                          {}

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

func RegisterSparkTreeServiceServer(s grpc.ServiceRegistrar, srv SparkTreeServiceServer) {
	// If the following call pancis, it indicates UnimplementedSparkTreeServiceServer 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(&SparkTreeService_ServiceDesc, srv)
}

func _SparkTreeService_GetLeafDenominationCounts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(GetLeafDenominationCountsRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(SparkTreeServiceServer).GetLeafDenominationCounts(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: SparkTreeService_GetLeafDenominationCounts_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(SparkTreeServiceServer).GetLeafDenominationCounts(ctx, req.(*GetLeafDenominationCountsRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _SparkTreeService_FetchPolarityScores_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(FetchPolarityScoreRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(SparkTreeServiceServer).FetchPolarityScores(m, &grpc.GenericServerStream[FetchPolarityScoreRequest, PolarityScore]{ServerStream: stream})
}

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

// SparkTreeService_ServiceDesc is the grpc.ServiceDesc for SparkTreeService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var SparkTreeService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "spark.SparkTreeService",
	HandlerType: (*SparkTreeServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "get_leaf_denomination_counts",
			Handler:    _SparkTreeService_GetLeafDenominationCounts_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "fetch_polarity_scores",
			Handler:       _SparkTreeService_FetchPolarityScores_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "spark_tree.proto",
}
