// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             v4.25.3
// source: controller.proto

package rpc

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.32.0 or later.
const _ = grpc.SupportPackageIsVersion7

const (
	ControllerRegisterService_RegisterAgent_FullMethodName    = "/controller_rpc.ControllerRegisterService/RegisterAgent"
	ControllerRegisterService_ReportEvents_FullMethodName     = "/controller_rpc.ControllerRegisterService/ReportEvents"
	ControllerRegisterService_WatchTasks_FullMethodName       = "/controller_rpc.ControllerRegisterService/WatchTasks"
	ControllerRegisterService_UploadTaskResult_FullMethodName = "/controller_rpc.ControllerRegisterService/UploadTaskResult"
)

// ControllerRegisterServiceClient is the client API for ControllerRegisterService 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 ControllerRegisterServiceClient interface {
	// Agent Health Check
	RegisterAgent(ctx context.Context, in *AgentInfo, opts ...grpc.CallOption) (*ControllerInfo, error)
	ReportEvents(ctx context.Context, opts ...grpc.CallOption) (ControllerRegisterService_ReportEventsClient, error)
	WatchTasks(ctx context.Context, in *TaskFilter, opts ...grpc.CallOption) (ControllerRegisterService_WatchTasksClient, error)
	UploadTaskResult(ctx context.Context, in *TaskResult, opts ...grpc.CallOption) (*TaskResultReply, error)
}

type controllerRegisterServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewControllerRegisterServiceClient(cc grpc.ClientConnInterface) ControllerRegisterServiceClient {
	return &controllerRegisterServiceClient{cc}
}

func (c *controllerRegisterServiceClient) RegisterAgent(ctx context.Context, in *AgentInfo, opts ...grpc.CallOption) (*ControllerInfo, error) {
	out := new(ControllerInfo)
	err := c.cc.Invoke(ctx, ControllerRegisterService_RegisterAgent_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *controllerRegisterServiceClient) ReportEvents(ctx context.Context, opts ...grpc.CallOption) (ControllerRegisterService_ReportEventsClient, error) {
	stream, err := c.cc.NewStream(ctx, &ControllerRegisterService_ServiceDesc.Streams[0], ControllerRegisterService_ReportEvents_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &controllerRegisterServiceReportEventsClient{stream}
	return x, nil
}

type ControllerRegisterService_ReportEventsClient interface {
	Send(*Event) error
	CloseAndRecv() (*EventReply, error)
	grpc.ClientStream
}

type controllerRegisterServiceReportEventsClient struct {
	grpc.ClientStream
}

func (x *controllerRegisterServiceReportEventsClient) Send(m *Event) error {
	return x.ClientStream.SendMsg(m)
}

func (x *controllerRegisterServiceReportEventsClient) CloseAndRecv() (*EventReply, error) {
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	m := new(EventReply)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *controllerRegisterServiceClient) WatchTasks(ctx context.Context, in *TaskFilter, opts ...grpc.CallOption) (ControllerRegisterService_WatchTasksClient, error) {
	stream, err := c.cc.NewStream(ctx, &ControllerRegisterService_ServiceDesc.Streams[1], ControllerRegisterService_WatchTasks_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &controllerRegisterServiceWatchTasksClient{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
}

type ControllerRegisterService_WatchTasksClient interface {
	Recv() (*ServerTask, error)
	grpc.ClientStream
}

type controllerRegisterServiceWatchTasksClient struct {
	grpc.ClientStream
}

func (x *controllerRegisterServiceWatchTasksClient) Recv() (*ServerTask, error) {
	m := new(ServerTask)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *controllerRegisterServiceClient) UploadTaskResult(ctx context.Context, in *TaskResult, opts ...grpc.CallOption) (*TaskResultReply, error) {
	out := new(TaskResultReply)
	err := c.cc.Invoke(ctx, ControllerRegisterService_UploadTaskResult_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// ControllerRegisterServiceServer is the server API for ControllerRegisterService service.
// All implementations must embed UnimplementedControllerRegisterServiceServer
// for forward compatibility
type ControllerRegisterServiceServer interface {
	// Agent Health Check
	RegisterAgent(context.Context, *AgentInfo) (*ControllerInfo, error)
	ReportEvents(ControllerRegisterService_ReportEventsServer) error
	WatchTasks(*TaskFilter, ControllerRegisterService_WatchTasksServer) error
	UploadTaskResult(context.Context, *TaskResult) (*TaskResultReply, error)
	mustEmbedUnimplementedControllerRegisterServiceServer()
}

// UnimplementedControllerRegisterServiceServer must be embedded to have forward compatible implementations.
type UnimplementedControllerRegisterServiceServer struct {
}

func (UnimplementedControllerRegisterServiceServer) RegisterAgent(context.Context, *AgentInfo) (*ControllerInfo, error) {
	return nil, status.Errorf(codes.Unimplemented, "method RegisterAgent not implemented")
}
func (UnimplementedControllerRegisterServiceServer) ReportEvents(ControllerRegisterService_ReportEventsServer) error {
	return status.Errorf(codes.Unimplemented, "method ReportEvents not implemented")
}
func (UnimplementedControllerRegisterServiceServer) WatchTasks(*TaskFilter, ControllerRegisterService_WatchTasksServer) error {
	return status.Errorf(codes.Unimplemented, "method WatchTasks not implemented")
}
func (UnimplementedControllerRegisterServiceServer) UploadTaskResult(context.Context, *TaskResult) (*TaskResultReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method UploadTaskResult not implemented")
}
func (UnimplementedControllerRegisterServiceServer) mustEmbedUnimplementedControllerRegisterServiceServer() {
}

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

func RegisterControllerRegisterServiceServer(s grpc.ServiceRegistrar, srv ControllerRegisterServiceServer) {
	s.RegisterService(&ControllerRegisterService_ServiceDesc, srv)
}

func _ControllerRegisterService_RegisterAgent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(AgentInfo)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ControllerRegisterServiceServer).RegisterAgent(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: ControllerRegisterService_RegisterAgent_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ControllerRegisterServiceServer).RegisterAgent(ctx, req.(*AgentInfo))
	}
	return interceptor(ctx, in, info, handler)
}

func _ControllerRegisterService_ReportEvents_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(ControllerRegisterServiceServer).ReportEvents(&controllerRegisterServiceReportEventsServer{stream})
}

type ControllerRegisterService_ReportEventsServer interface {
	SendAndClose(*EventReply) error
	Recv() (*Event, error)
	grpc.ServerStream
}

type controllerRegisterServiceReportEventsServer struct {
	grpc.ServerStream
}

func (x *controllerRegisterServiceReportEventsServer) SendAndClose(m *EventReply) error {
	return x.ServerStream.SendMsg(m)
}

func (x *controllerRegisterServiceReportEventsServer) Recv() (*Event, error) {
	m := new(Event)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _ControllerRegisterService_WatchTasks_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(TaskFilter)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(ControllerRegisterServiceServer).WatchTasks(m, &controllerRegisterServiceWatchTasksServer{stream})
}

type ControllerRegisterService_WatchTasksServer interface {
	Send(*ServerTask) error
	grpc.ServerStream
}

type controllerRegisterServiceWatchTasksServer struct {
	grpc.ServerStream
}

func (x *controllerRegisterServiceWatchTasksServer) Send(m *ServerTask) error {
	return x.ServerStream.SendMsg(m)
}

func _ControllerRegisterService_UploadTaskResult_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(TaskResult)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(ControllerRegisterServiceServer).UploadTaskResult(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: ControllerRegisterService_UploadTaskResult_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(ControllerRegisterServiceServer).UploadTaskResult(ctx, req.(*TaskResult))
	}
	return interceptor(ctx, in, info, handler)
}

// ControllerRegisterService_ServiceDesc is the grpc.ServiceDesc for ControllerRegisterService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ControllerRegisterService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "controller_rpc.ControllerRegisterService",
	HandlerType: (*ControllerRegisterServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "RegisterAgent",
			Handler:    _ControllerRegisterService_RegisterAgent_Handler,
		},
		{
			MethodName: "UploadTaskResult",
			Handler:    _ControllerRegisterService_UploadTaskResult_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "ReportEvents",
			Handler:       _ControllerRegisterService_ReportEvents_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "WatchTasks",
			Handler:       _ControllerRegisterService_WatchTasks_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "controller.proto",
}
