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

package avsproto

import (
	context "context"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	wrapperspb "google.golang.org/protobuf/types/known/wrapperspb"
)

// 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 (
	Node_HealthCheck_FullMethodName         = "/aggregator.Node/HealthCheck"
	Node_Ping_FullMethodName                = "/aggregator.Node/Ping"
	Node_SyncMessages_FullMethodName        = "/aggregator.Node/SyncMessages"
	Node_Ack_FullMethodName                 = "/aggregator.Node/Ack"
	Node_NotifyTriggers_FullMethodName      = "/aggregator.Node/NotifyTriggers"
	Node_ReportEventOverload_FullMethodName = "/aggregator.Node/ReportEventOverload"
)

// NodeClient is the client API for Node 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 NodeClient interface {
	// Connection testing endpoint - doesn't store any data
	HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
	// Operator endpoint
	Ping(ctx context.Context, in *Checkin, opts ...grpc.CallOption) (*CheckinResp, error)
	SyncMessages(ctx context.Context, in *SyncMessagesReq, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SyncMessagesResp], error)
	Ack(ctx context.Context, in *AckMessageReq, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error)
	NotifyTriggers(ctx context.Context, in *NotifyTriggersReq, opts ...grpc.CallOption) (*NotifyTriggersResp, error)
	// Internal operator safety reporting
	ReportEventOverload(ctx context.Context, in *EventOverloadAlert, opts ...grpc.CallOption) (*EventOverloadResponse, error)
}

type nodeClient struct {
	cc grpc.ClientConnInterface
}

func NewNodeClient(cc grpc.ClientConnInterface) NodeClient {
	return &nodeClient{cc}
}

func (c *nodeClient) HealthCheck(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(HealthCheckResponse)
	err := c.cc.Invoke(ctx, Node_HealthCheck_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nodeClient) Ping(ctx context.Context, in *Checkin, opts ...grpc.CallOption) (*CheckinResp, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(CheckinResp)
	err := c.cc.Invoke(ctx, Node_Ping_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nodeClient) SyncMessages(ctx context.Context, in *SyncMessagesReq, opts ...grpc.CallOption) (grpc.ServerStreamingClient[SyncMessagesResp], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &Node_ServiceDesc.Streams[0], Node_SyncMessages_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[SyncMessagesReq, SyncMessagesResp]{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 Node_SyncMessagesClient = grpc.ServerStreamingClient[SyncMessagesResp]

func (c *nodeClient) Ack(ctx context.Context, in *AckMessageReq, opts ...grpc.CallOption) (*wrapperspb.BoolValue, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(wrapperspb.BoolValue)
	err := c.cc.Invoke(ctx, Node_Ack_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nodeClient) NotifyTriggers(ctx context.Context, in *NotifyTriggersReq, opts ...grpc.CallOption) (*NotifyTriggersResp, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(NotifyTriggersResp)
	err := c.cc.Invoke(ctx, Node_NotifyTriggers_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *nodeClient) ReportEventOverload(ctx context.Context, in *EventOverloadAlert, opts ...grpc.CallOption) (*EventOverloadResponse, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	out := new(EventOverloadResponse)
	err := c.cc.Invoke(ctx, Node_ReportEventOverload_FullMethodName, in, out, cOpts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// NodeServer is the server API for Node service.
// All implementations must embed UnimplementedNodeServer
// for forward compatibility.
type NodeServer interface {
	// Connection testing endpoint - doesn't store any data
	HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
	// Operator endpoint
	Ping(context.Context, *Checkin) (*CheckinResp, error)
	SyncMessages(*SyncMessagesReq, grpc.ServerStreamingServer[SyncMessagesResp]) error
	Ack(context.Context, *AckMessageReq) (*wrapperspb.BoolValue, error)
	NotifyTriggers(context.Context, *NotifyTriggersReq) (*NotifyTriggersResp, error)
	// Internal operator safety reporting
	ReportEventOverload(context.Context, *EventOverloadAlert) (*EventOverloadResponse, error)
	mustEmbedUnimplementedNodeServer()
}

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

func (UnimplementedNodeServer) HealthCheck(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method HealthCheck not implemented")
}
func (UnimplementedNodeServer) Ping(context.Context, *Checkin) (*CheckinResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedNodeServer) SyncMessages(*SyncMessagesReq, grpc.ServerStreamingServer[SyncMessagesResp]) error {
	return status.Errorf(codes.Unimplemented, "method SyncMessages not implemented")
}
func (UnimplementedNodeServer) Ack(context.Context, *AckMessageReq) (*wrapperspb.BoolValue, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Ack not implemented")
}
func (UnimplementedNodeServer) NotifyTriggers(context.Context, *NotifyTriggersReq) (*NotifyTriggersResp, error) {
	return nil, status.Errorf(codes.Unimplemented, "method NotifyTriggers not implemented")
}
func (UnimplementedNodeServer) ReportEventOverload(context.Context, *EventOverloadAlert) (*EventOverloadResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ReportEventOverload not implemented")
}
func (UnimplementedNodeServer) mustEmbedUnimplementedNodeServer() {}
func (UnimplementedNodeServer) testEmbeddedByValue()              {}

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

func RegisterNodeServer(s grpc.ServiceRegistrar, srv NodeServer) {
	// If the following call pancis, it indicates UnimplementedNodeServer 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(&Node_ServiceDesc, srv)
}

func _Node_HealthCheck_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(HealthCheckRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NodeServer).HealthCheck(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Node_HealthCheck_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NodeServer).HealthCheck(ctx, req.(*HealthCheckRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Node_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(Checkin)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NodeServer).Ping(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Node_Ping_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NodeServer).Ping(ctx, req.(*Checkin))
	}
	return interceptor(ctx, in, info, handler)
}

func _Node_SyncMessages_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(SyncMessagesReq)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(NodeServer).SyncMessages(m, &grpc.GenericServerStream[SyncMessagesReq, SyncMessagesResp]{ServerStream: stream})
}

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

func _Node_Ack_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AckMessageReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NodeServer).Ack(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Node_Ack_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NodeServer).Ack(ctx, req.(*AckMessageReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Node_NotifyTriggers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(NotifyTriggersReq)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NodeServer).NotifyTriggers(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Node_NotifyTriggers_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NodeServer).NotifyTriggers(ctx, req.(*NotifyTriggersReq))
	}
	return interceptor(ctx, in, info, handler)
}

func _Node_ReportEventOverload_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(EventOverloadAlert)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(NodeServer).ReportEventOverload(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: Node_ReportEventOverload_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(NodeServer).ReportEventOverload(ctx, req.(*EventOverloadAlert))
	}
	return interceptor(ctx, in, info, handler)
}

// Node_ServiceDesc is the grpc.ServiceDesc for Node service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Node_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "aggregator.Node",
	HandlerType: (*NodeServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "HealthCheck",
			Handler:    _Node_HealthCheck_Handler,
		},
		{
			MethodName: "Ping",
			Handler:    _Node_Ping_Handler,
		},
		{
			MethodName: "Ack",
			Handler:    _Node_Ack_Handler,
		},
		{
			MethodName: "NotifyTriggers",
			Handler:    _Node_NotifyTriggers_Handler,
		},
		{
			MethodName: "ReportEventOverload",
			Handler:    _Node_ReportEventOverload_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "SyncMessages",
			Handler:       _Node_SyncMessages_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "node.proto",
}
