// Code generated by protoc-gen-go-grpc. DO NOT EDIT.

package monitor

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

// MonitorServiceClient is the client API for MonitorService 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.
//
// Deprecated: Do not use.
type MonitorServiceClient interface {
	// Open a bidirectional monitor stream. This can be used to implement
	// something similar to the Arduino IDE's Serial Monitor.
	StreamingOpen(ctx context.Context, opts ...grpc.CallOption) (MonitorService_StreamingOpenClient, error)
}

type monitorServiceClient struct {
	cc grpc.ClientConnInterface
}

// Deprecated: Do not use.
func NewMonitorServiceClient(cc grpc.ClientConnInterface) MonitorServiceClient {
	return &monitorServiceClient{cc}
}

func (c *monitorServiceClient) StreamingOpen(ctx context.Context, opts ...grpc.CallOption) (MonitorService_StreamingOpenClient, error) {
	stream, err := c.cc.NewStream(ctx, &MonitorService_ServiceDesc.Streams[0], "/cc.arduino.cli.monitor.v1.MonitorService/StreamingOpen", opts...)
	if err != nil {
		return nil, err
	}
	x := &monitorServiceStreamingOpenClient{stream}
	return x, nil
}

type MonitorService_StreamingOpenClient interface {
	Send(*StreamingOpenRequest) error
	Recv() (*StreamingOpenResponse, error)
	grpc.ClientStream
}

type monitorServiceStreamingOpenClient struct {
	grpc.ClientStream
}

func (x *monitorServiceStreamingOpenClient) Send(m *StreamingOpenRequest) error {
	return x.ClientStream.SendMsg(m)
}

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

// MonitorServiceServer is the server API for MonitorService service.
// All implementations must embed UnimplementedMonitorServiceServer
// for forward compatibility
//
// Deprecated: Do not use.
type MonitorServiceServer interface {
	// Open a bidirectional monitor stream. This can be used to implement
	// something similar to the Arduino IDE's Serial Monitor.
	StreamingOpen(MonitorService_StreamingOpenServer) error
	mustEmbedUnimplementedMonitorServiceServer()
}

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

func (UnimplementedMonitorServiceServer) StreamingOpen(MonitorService_StreamingOpenServer) error {
	return status.Errorf(codes.Unimplemented, "method StreamingOpen not implemented")
}
func (UnimplementedMonitorServiceServer) mustEmbedUnimplementedMonitorServiceServer() {}

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

// Deprecated: Do not use.
func RegisterMonitorServiceServer(s grpc.ServiceRegistrar, srv MonitorServiceServer) {
	s.RegisterService(&MonitorService_ServiceDesc, srv)
}

func _MonitorService_StreamingOpen_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(MonitorServiceServer).StreamingOpen(&monitorServiceStreamingOpenServer{stream})
}

type MonitorService_StreamingOpenServer interface {
	Send(*StreamingOpenResponse) error
	Recv() (*StreamingOpenRequest, error)
	grpc.ServerStream
}

type monitorServiceStreamingOpenServer struct {
	grpc.ServerStream
}

func (x *monitorServiceStreamingOpenServer) Send(m *StreamingOpenResponse) error {
	return x.ServerStream.SendMsg(m)
}

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

// MonitorService_ServiceDesc is the grpc.ServiceDesc for MonitorService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var MonitorService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "cc.arduino.cli.monitor.v1.MonitorService",
	HandlerType: (*MonitorServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "StreamingOpen",
			Handler:       _MonitorService_StreamingOpen_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "cc/arduino/cli/monitor/v1/monitor.proto",
}
