// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.6.1
// - protoc             (unknown)
// source: clawkerd/v1/clawkerd.proto

package v1

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.64.0 or later.
const _ = grpc.SupportPackageIsVersion9

const (
	ClawkerdService_Session_FullMethodName = "/clawker.clawkerd.v1.ClawkerdService/Session"
)

// ClawkerdServiceClient is the client API for ClawkerdService 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.
//
// ClawkerdService is the gRPC surface CP calls on clawkerd (the per-
// container agent daemon).
//
// Transport: mTLS over TCP on clawkerd's listener inside the agent
// container (port consts.DefaultClawkerdPort), reachable from CP via
// clawker-net. The listener
// requires a peer cert chained to the clawker CA AND pins the peer's
// CN to consts.ContainerCP — the sole legitimate caller is CP. Any
// other clawker-CA-signed cert (e.g. another agent's) is rejected at
// the TLS layer. Without CN pinning, agent-to-agent privilege
// escalation would be possible.
//
// No JWT/bearer layer on this listener — mTLS + CN pin is the entire
// auth check.
//
// Topology: CP is gRPC-client, clawkerd is server. Session is bidi:
// CP streams Commands; clawkerd streams Responses. command_id
// correlates each Response back to the Command that produced it,
// allowing concurrent commands per Session.
type ClawkerdServiceClient interface {
	// Session is the lifetime command channel from CP to clawkerd.
	// CP opens the stream, sends Hello as the first Command, then
	// dispatches ShellCommand / Stdin / CloseStdin / Signal as
	// needed. clawkerd streams Responses correlated by command_id.
	Session(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Command, Response], error)
}

type clawkerdServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewClawkerdServiceClient(cc grpc.ClientConnInterface) ClawkerdServiceClient {
	return &clawkerdServiceClient{cc}
}

func (c *clawkerdServiceClient) Session(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[Command, Response], error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &ClawkerdService_ServiceDesc.Streams[0], ClawkerdService_Session_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &grpc.GenericClientStream[Command, Response]{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 ClawkerdService_SessionClient = grpc.BidiStreamingClient[Command, Response]

// ClawkerdServiceServer is the server API for ClawkerdService service.
// All implementations must embed UnimplementedClawkerdServiceServer
// for forward compatibility.
//
// ClawkerdService is the gRPC surface CP calls on clawkerd (the per-
// container agent daemon).
//
// Transport: mTLS over TCP on clawkerd's listener inside the agent
// container (port consts.DefaultClawkerdPort), reachable from CP via
// clawker-net. The listener
// requires a peer cert chained to the clawker CA AND pins the peer's
// CN to consts.ContainerCP — the sole legitimate caller is CP. Any
// other clawker-CA-signed cert (e.g. another agent's) is rejected at
// the TLS layer. Without CN pinning, agent-to-agent privilege
// escalation would be possible.
//
// No JWT/bearer layer on this listener — mTLS + CN pin is the entire
// auth check.
//
// Topology: CP is gRPC-client, clawkerd is server. Session is bidi:
// CP streams Commands; clawkerd streams Responses. command_id
// correlates each Response back to the Command that produced it,
// allowing concurrent commands per Session.
type ClawkerdServiceServer interface {
	// Session is the lifetime command channel from CP to clawkerd.
	// CP opens the stream, sends Hello as the first Command, then
	// dispatches ShellCommand / Stdin / CloseStdin / Signal as
	// needed. clawkerd streams Responses correlated by command_id.
	Session(grpc.BidiStreamingServer[Command, Response]) error
	mustEmbedUnimplementedClawkerdServiceServer()
}

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

func (UnimplementedClawkerdServiceServer) Session(grpc.BidiStreamingServer[Command, Response]) error {
	return status.Error(codes.Unimplemented, "method Session not implemented")
}
func (UnimplementedClawkerdServiceServer) mustEmbedUnimplementedClawkerdServiceServer() {}
func (UnimplementedClawkerdServiceServer) testEmbeddedByValue()                         {}

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

func RegisterClawkerdServiceServer(s grpc.ServiceRegistrar, srv ClawkerdServiceServer) {
	// If the following call panics, it indicates UnimplementedClawkerdServiceServer 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(&ClawkerdService_ServiceDesc, srv)
}

func _ClawkerdService_Session_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(ClawkerdServiceServer).Session(&grpc.GenericServerStream[Command, Response]{ServerStream: stream})
}

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

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