// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc             v5.29.3
// source: cilium/api/nphds.proto

package cilium

import (
	context "context"
	v3 "github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3"
	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 (
	NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHosts_FullMethodName = "/cilium.NetworkPolicyHostsDiscoveryService/StreamNetworkPolicyHosts"
	NetworkPolicyHostsDiscoveryService_FetchNetworkPolicyHosts_FullMethodName  = "/cilium.NetworkPolicyHostsDiscoveryService/FetchNetworkPolicyHosts"
)

// NetworkPolicyHostsDiscoveryServiceClient is the client API for NetworkPolicyHostsDiscoveryService 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.
//
// Each resource name is a network policy identifier in decimal, e.g. `123`.
type NetworkPolicyHostsDiscoveryServiceClient interface {
	StreamNetworkPolicyHosts(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[v3.DiscoveryRequest, v3.DiscoveryResponse], error)
	FetchNetworkPolicyHosts(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error)
}

type networkPolicyHostsDiscoveryServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewNetworkPolicyHostsDiscoveryServiceClient(cc grpc.ClientConnInterface) NetworkPolicyHostsDiscoveryServiceClient {
	return &networkPolicyHostsDiscoveryServiceClient{cc}
}

func (c *networkPolicyHostsDiscoveryServiceClient) StreamNetworkPolicyHosts(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[v3.DiscoveryRequest, v3.DiscoveryResponse], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &NetworkPolicyHostsDiscoveryService_ServiceDesc.Streams[0], NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHosts_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[v3.DiscoveryRequest, v3.DiscoveryResponse]{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 NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHostsClient = grpc.BidiStreamingClient[v3.DiscoveryRequest, v3.DiscoveryResponse]

func (c *networkPolicyHostsDiscoveryServiceClient) FetchNetworkPolicyHosts(ctx context.Context, in *v3.DiscoveryRequest, opts ...grpc.CallOption) (*v3.DiscoveryResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(v3.DiscoveryResponse)
	err := c.cc.Invoke(ctx, NetworkPolicyHostsDiscoveryService_FetchNetworkPolicyHosts_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// NetworkPolicyHostsDiscoveryServiceServer is the server API for NetworkPolicyHostsDiscoveryService service.
// All implementations must embed UnimplementedNetworkPolicyHostsDiscoveryServiceServer
// for forward compatibility.
//
// Each resource name is a network policy identifier in decimal, e.g. `123`.
type NetworkPolicyHostsDiscoveryServiceServer interface {
	StreamNetworkPolicyHosts(grpc.BidiStreamingServer[v3.DiscoveryRequest, v3.DiscoveryResponse]) error
	FetchNetworkPolicyHosts(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error)
	mustEmbedUnimplementedNetworkPolicyHostsDiscoveryServiceServer()
}

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

func (UnimplementedNetworkPolicyHostsDiscoveryServiceServer) StreamNetworkPolicyHosts(grpc.BidiStreamingServer[v3.DiscoveryRequest, v3.DiscoveryResponse]) error {
	return status.Error(codes.Unimplemented, "method StreamNetworkPolicyHosts not implemented")
}
func (UnimplementedNetworkPolicyHostsDiscoveryServiceServer) FetchNetworkPolicyHosts(context.Context, *v3.DiscoveryRequest) (*v3.DiscoveryResponse, error) {
	return nil, status.Error(codes.Unimplemented, "method FetchNetworkPolicyHosts not implemented")
}
func (UnimplementedNetworkPolicyHostsDiscoveryServiceServer) mustEmbedUnimplementedNetworkPolicyHostsDiscoveryServiceServer() {
}
func (UnimplementedNetworkPolicyHostsDiscoveryServiceServer) testEmbeddedByValue() {}

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

func RegisterNetworkPolicyHostsDiscoveryServiceServer(s grpc.ServiceRegistrar, srv NetworkPolicyHostsDiscoveryServiceServer) {
	// If the following call panics, it indicates UnimplementedNetworkPolicyHostsDiscoveryServiceServer 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(&NetworkPolicyHostsDiscoveryService_ServiceDesc, srv)
}

func _NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHosts_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(NetworkPolicyHostsDiscoveryServiceServer).StreamNetworkPolicyHosts(&grpc.GenericServerStream[v3.DiscoveryRequest, v3.DiscoveryResponse]{ServerStream: stream})
}

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

func _NetworkPolicyHostsDiscoveryService_FetchNetworkPolicyHosts_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(v3.DiscoveryRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NetworkPolicyHostsDiscoveryServiceServer).FetchNetworkPolicyHosts(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: NetworkPolicyHostsDiscoveryService_FetchNetworkPolicyHosts_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NetworkPolicyHostsDiscoveryServiceServer).FetchNetworkPolicyHosts(ctx, req.(*v3.DiscoveryRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// NetworkPolicyHostsDiscoveryService_ServiceDesc is the grpc.ServiceDesc for NetworkPolicyHostsDiscoveryService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var NetworkPolicyHostsDiscoveryService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cilium.NetworkPolicyHostsDiscoveryService",
	HandlerType: (*NetworkPolicyHostsDiscoveryServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "FetchNetworkPolicyHosts",
			Handler:    _NetworkPolicyHostsDiscoveryService_FetchNetworkPolicyHosts_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamNetworkPolicyHosts",
			Handler:       _NetworkPolicyHostsDiscoveryService_StreamNetworkPolicyHosts_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "cilium/api/nphds.proto",
}
