// Copyright AGNTCY Contributors (https://github.com/agntcy)
// SPDX-License-Identifier: Apache-2.0

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.4.0
// - protoc             v5.29.0
// source: controller/v1/controller.proto

package controllerv1

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.62.0 or later.
const _ = grpc.SupportPackageIsVersion8

const (
	ControllerService_OpenControlChannel_FullMethodName = "/controller.proto.v1.ControllerService/OpenControlChannel"
)

// ControllerServiceClient is the client API for ControllerService 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 ControllerServiceClient interface {
	OpenControlChannel(ctx context.Context, opts ...grpc.CallOption) (ControllerService_OpenControlChannelClient, error)
}

type controllerServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewControllerServiceClient(cc grpc.ClientConnInterface) ControllerServiceClient {
	return &controllerServiceClient{cc}
}

func (c *controllerServiceClient) OpenControlChannel(ctx context.Context, opts ...grpc.CallOption) (ControllerService_OpenControlChannelClient, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ControllerService_ServiceDesc.Streams[0], ControllerService_OpenControlChannel_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &controllerServiceOpenControlChannelClient{ClientStream: stream}
	return x, nil
}

type ControllerService_OpenControlChannelClient interface {
	Send(*ControlMessage) error
	Recv() (*ControlMessage, error)
	grpc.ClientStream
}

type controllerServiceOpenControlChannelClient struct {
	grpc.ClientStream
}

func (x *controllerServiceOpenControlChannelClient) Send(m *ControlMessage) error {
	return x.ClientStream.SendMsg(m)
}

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

// ControllerServiceServer is the server API for ControllerService service.
// All implementations must embed UnimplementedControllerServiceServer
// for forward compatibility
type ControllerServiceServer interface {
	OpenControlChannel(ControllerService_OpenControlChannelServer) error
	mustEmbedUnimplementedControllerServiceServer()
}

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

func (UnimplementedControllerServiceServer) OpenControlChannel(ControllerService_OpenControlChannelServer) error {
	return status.Errorf(codes.Unimplemented, "method OpenControlChannel not implemented")
}
func (UnimplementedControllerServiceServer) mustEmbedUnimplementedControllerServiceServer() {}

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

func RegisterControllerServiceServer(s grpc.ServiceRegistrar, srv ControllerServiceServer) {
	s.RegisterService(&ControllerService_ServiceDesc, srv)
}

func _ControllerService_OpenControlChannel_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(ControllerServiceServer).OpenControlChannel(&controllerServiceOpenControlChannelServer{ServerStream: stream})
}

type ControllerService_OpenControlChannelServer interface {
	Send(*ControlMessage) error
	Recv() (*ControlMessage, error)
	grpc.ServerStream
}

type controllerServiceOpenControlChannelServer struct {
	grpc.ServerStream
}

func (x *controllerServiceOpenControlChannelServer) Send(m *ControlMessage) error {
	return x.ServerStream.SendMsg(m)
}

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

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