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

package informer

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 (
	EventStreamService_Subscribe_FullMethodName = "/informer.EventStreamService/Subscribe"
)

// EventStreamServiceClient is the client API for EventStreamService 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.
//
// EventStreamService defines the gRPC service for event streaming.
type EventStreamServiceClient interface {
	// Subscribe allows clients to subscribe to a stream of events.
	Subscribe(ctx context.Context, in *SubscribeMessage, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Event], error)
}

type eventStreamServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewEventStreamServiceClient(cc grpc.ClientConnInterface) EventStreamServiceClient {
	return &eventStreamServiceClient{cc}
}

func (c *eventStreamServiceClient) Subscribe(ctx context.Context, in *SubscribeMessage, opts ...grpc.CallOption) (grpc.ServerStreamingClient[Event], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &EventStreamService_ServiceDesc.Streams[0], EventStreamService_Subscribe_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[SubscribeMessage, Event]{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 EventStreamService_SubscribeClient = grpc.ServerStreamingClient[Event]

// EventStreamServiceServer is the server API for EventStreamService service.
// All implementations must embed UnimplementedEventStreamServiceServer
// for forward compatibility.
//
// EventStreamService defines the gRPC service for event streaming.
type EventStreamServiceServer interface {
	// Subscribe allows clients to subscribe to a stream of events.
	Subscribe(*SubscribeMessage, grpc.ServerStreamingServer[Event]) error
	mustEmbedUnimplementedEventStreamServiceServer()
}

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

func (UnimplementedEventStreamServiceServer) Subscribe(*SubscribeMessage, grpc.ServerStreamingServer[Event]) error {
	return status.Errorf(codes.Unimplemented, "method Subscribe not implemented")
}
func (UnimplementedEventStreamServiceServer) mustEmbedUnimplementedEventStreamServiceServer() {}
func (UnimplementedEventStreamServiceServer) testEmbeddedByValue()                            {}

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

func RegisterEventStreamServiceServer(s grpc.ServiceRegistrar, srv EventStreamServiceServer) {
	// If the following call pancis, it indicates UnimplementedEventStreamServiceServer 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(&EventStreamService_ServiceDesc, srv)
}

func _EventStreamService_Subscribe_Handler(srv any, stream grpc.ServerStream) error {
	m := new(SubscribeMessage)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(EventStreamServiceServer).Subscribe(m, &grpc.GenericServerStream[SubscribeMessage, Event]{ServerStream: stream})
}

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

// EventStreamService_ServiceDesc is the grpc.ServiceDesc for EventStreamService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var EventStreamService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "informer.EventStreamService",
	HandlerType: (*EventStreamServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Subscribe",
			Handler:       _EventStreamService_Subscribe_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "proto/informer.proto",
}
