// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.2
// - protoc             (unknown)
// source: broadannounce/v1/ingest.proto

package broadannouncev1

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 (
	Ingest_StreamAlerts_FullMethodName = "/broadannounce.v1.Ingest/StreamAlerts"
)

// IngestClient is the client API for Ingest 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.
//
// Ingest is the gRPC service for first-party, high-volume alert sources.
// It runs on a dedicated port (default :9090) inside the tenant's VPC;
// external webhook sources continue to use HTTP POST on :8800.
type IngestClient interface {
	// StreamAlerts is a bidirectional stream: the client sends zero or more
	// Alerts, the server sends exactly one Ack for each Alert received.
	//
	// Flow:
	//  1. Client opens stream (auth metadata required on the call)
	//  2. Client streams Alerts; server processes each concurrently
	//  3. Server streams back Acks as they are ready (order not guaranteed)
	//  4. Client reads Acks and adjusts send rate accordingly
	//
	// Backpressure: if the server's in-flight buffer (256 msgs) fills up,
	// it sends Error.RATE_LIMITED with retry_after_ms > 0. The client MUST
	// honour that delay before resuming.
	StreamAlerts(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Alert, Ack], error)
}

type ingestClient struct {
	cc grpc.ClientConnInterface
}

func NewIngestClient(cc grpc.ClientConnInterface) IngestClient {
	return &ingestClient{cc}
}

func (c *ingestClient) StreamAlerts(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Alert, Ack], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Ingest_ServiceDesc.Streams[0], Ingest_StreamAlerts_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[Alert, Ack]{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 Ingest_StreamAlertsClient = grpc.BidiStreamingClient[Alert, Ack]

// IngestServer is the server API for Ingest service.
// All implementations must embed UnimplementedIngestServer
// for forward compatibility.
//
// Ingest is the gRPC service for first-party, high-volume alert sources.
// It runs on a dedicated port (default :9090) inside the tenant's VPC;
// external webhook sources continue to use HTTP POST on :8800.
type IngestServer interface {
	// StreamAlerts is a bidirectional stream: the client sends zero or more
	// Alerts, the server sends exactly one Ack for each Alert received.
	//
	// Flow:
	//  1. Client opens stream (auth metadata required on the call)
	//  2. Client streams Alerts; server processes each concurrently
	//  3. Server streams back Acks as they are ready (order not guaranteed)
	//  4. Client reads Acks and adjusts send rate accordingly
	//
	// Backpressure: if the server's in-flight buffer (256 msgs) fills up,
	// it sends Error.RATE_LIMITED with retry_after_ms > 0. The client MUST
	// honour that delay before resuming.
	StreamAlerts(grpc.BidiStreamingServer[Alert, Ack]) error
	mustEmbedUnimplementedIngestServer()
}

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

func (UnimplementedIngestServer) StreamAlerts(grpc.BidiStreamingServer[Alert, Ack]) error {
	return status.Error(codes.Unimplemented, "method StreamAlerts not implemented")
}
func (UnimplementedIngestServer) mustEmbedUnimplementedIngestServer() {}
func (UnimplementedIngestServer) testEmbeddedByValue()                {}

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

func RegisterIngestServer(s grpc.ServiceRegistrar, srv IngestServer) {
	// If the following call panics, it indicates UnimplementedIngestServer 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(&Ingest_ServiceDesc, srv)
}

func _Ingest_StreamAlerts_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(IngestServer).StreamAlerts(&grpc.GenericServerStream[Alert, Ack]{ServerStream: stream})
}

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

// Ingest_ServiceDesc is the grpc.ServiceDesc for Ingest service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Ingest_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "broadannounce.v1.Ingest",
	HandlerType: (*IngestServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamAlerts",
			Handler:       _Ingest_StreamAlerts_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "broadannounce/v1/ingest.proto",
}
