// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: dutctl/v1/dutctl.proto

package dutctlv1connect

import (
	connect "connectrpc.com/connect"
	context "context"
	errors "errors"
	v1 "github.com/BlindspotSoftware/dutctl/protobuf/gen/dutctl/v1"
	http "net/http"
	strings "strings"
)

// This is a compile-time assertion to ensure that this generated file and the connect package are
// compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of connect newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of connect or updating the connect
// version compiled into your binary.
const _ = connect.IsAtLeastVersion1_13_0

const (
	// DeviceServiceName is the fully-qualified name of the DeviceService service.
	DeviceServiceName = "dutctl.v1.DeviceService"
	// RelayServiceName is the fully-qualified name of the RelayService service.
	RelayServiceName = "dutctl.v1.RelayService"
)

// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as Spec.Procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
	// DeviceServiceListProcedure is the fully-qualified name of the DeviceService's List RPC.
	DeviceServiceListProcedure = "/dutctl.v1.DeviceService/List"
	// DeviceServiceCommandsProcedure is the fully-qualified name of the DeviceService's Commands RPC.
	DeviceServiceCommandsProcedure = "/dutctl.v1.DeviceService/Commands"
	// DeviceServiceDetailsProcedure is the fully-qualified name of the DeviceService's Details RPC.
	DeviceServiceDetailsProcedure = "/dutctl.v1.DeviceService/Details"
	// DeviceServiceRunProcedure is the fully-qualified name of the DeviceService's Run RPC.
	DeviceServiceRunProcedure = "/dutctl.v1.DeviceService/Run"
	// RelayServiceRegisterProcedure is the fully-qualified name of the RelayService's Register RPC.
	RelayServiceRegisterProcedure = "/dutctl.v1.RelayService/Register"
)

// These variables are the protoreflect.Descriptor objects for the RPCs defined in this package.
var (
	deviceServiceServiceDescriptor        = v1.File_dutctl_v1_dutctl_proto.Services().ByName("DeviceService")
	deviceServiceListMethodDescriptor     = deviceServiceServiceDescriptor.Methods().ByName("List")
	deviceServiceCommandsMethodDescriptor = deviceServiceServiceDescriptor.Methods().ByName("Commands")
	deviceServiceDetailsMethodDescriptor  = deviceServiceServiceDescriptor.Methods().ByName("Details")
	deviceServiceRunMethodDescriptor      = deviceServiceServiceDescriptor.Methods().ByName("Run")
	relayServiceServiceDescriptor         = v1.File_dutctl_v1_dutctl_proto.Services().ByName("RelayService")
	relayServiceRegisterMethodDescriptor  = relayServiceServiceDescriptor.Methods().ByName("Register")
)

// DeviceServiceClient is a client for the dutctl.v1.DeviceService service.
type DeviceServiceClient interface {
	List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
	Commands(context.Context, *connect.Request[v1.CommandsRequest]) (*connect.Response[v1.CommandsResponse], error)
	Details(context.Context, *connect.Request[v1.DetailsRequest]) (*connect.Response[v1.DetailsResponse], error)
	Run(context.Context) *connect.BidiStreamForClient[v1.RunRequest, v1.RunResponse]
}

// NewDeviceServiceClient constructs a client for the dutctl.v1.DeviceService service. By default,
// it uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and
// sends uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC()
// or connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewDeviceServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) DeviceServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	return &deviceServiceClient{
		list: connect.NewClient[v1.ListRequest, v1.ListResponse](
			httpClient,
			baseURL+DeviceServiceListProcedure,
			connect.WithSchema(deviceServiceListMethodDescriptor),
			connect.WithClientOptions(opts...),
		),
		commands: connect.NewClient[v1.CommandsRequest, v1.CommandsResponse](
			httpClient,
			baseURL+DeviceServiceCommandsProcedure,
			connect.WithSchema(deviceServiceCommandsMethodDescriptor),
			connect.WithClientOptions(opts...),
		),
		details: connect.NewClient[v1.DetailsRequest, v1.DetailsResponse](
			httpClient,
			baseURL+DeviceServiceDetailsProcedure,
			connect.WithSchema(deviceServiceDetailsMethodDescriptor),
			connect.WithClientOptions(opts...),
		),
		run: connect.NewClient[v1.RunRequest, v1.RunResponse](
			httpClient,
			baseURL+DeviceServiceRunProcedure,
			connect.WithSchema(deviceServiceRunMethodDescriptor),
			connect.WithClientOptions(opts...),
		),
	}
}

// deviceServiceClient implements DeviceServiceClient.
type deviceServiceClient struct {
	list     *connect.Client[v1.ListRequest, v1.ListResponse]
	commands *connect.Client[v1.CommandsRequest, v1.CommandsResponse]
	details  *connect.Client[v1.DetailsRequest, v1.DetailsResponse]
	run      *connect.Client[v1.RunRequest, v1.RunResponse]
}

// List calls dutctl.v1.DeviceService.List.
func (c *deviceServiceClient) List(ctx context.Context, req *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error) {
	return c.list.CallUnary(ctx, req)
}

// Commands calls dutctl.v1.DeviceService.Commands.
func (c *deviceServiceClient) Commands(ctx context.Context, req *connect.Request[v1.CommandsRequest]) (*connect.Response[v1.CommandsResponse], error) {
	return c.commands.CallUnary(ctx, req)
}

// Details calls dutctl.v1.DeviceService.Details.
func (c *deviceServiceClient) Details(ctx context.Context, req *connect.Request[v1.DetailsRequest]) (*connect.Response[v1.DetailsResponse], error) {
	return c.details.CallUnary(ctx, req)
}

// Run calls dutctl.v1.DeviceService.Run.
func (c *deviceServiceClient) Run(ctx context.Context) *connect.BidiStreamForClient[v1.RunRequest, v1.RunResponse] {
	return c.run.CallBidiStream(ctx)
}

// DeviceServiceHandler is an implementation of the dutctl.v1.DeviceService service.
type DeviceServiceHandler interface {
	List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
	Commands(context.Context, *connect.Request[v1.CommandsRequest]) (*connect.Response[v1.CommandsResponse], error)
	Details(context.Context, *connect.Request[v1.DetailsRequest]) (*connect.Response[v1.DetailsResponse], error)
	Run(context.Context, *connect.BidiStream[v1.RunRequest, v1.RunResponse]) error
}

// NewDeviceServiceHandler builds an HTTP handler from the service implementation. It returns the
// path on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewDeviceServiceHandler(svc DeviceServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	deviceServiceListHandler := connect.NewUnaryHandler(
		DeviceServiceListProcedure,
		svc.List,
		connect.WithSchema(deviceServiceListMethodDescriptor),
		connect.WithHandlerOptions(opts...),
	)
	deviceServiceCommandsHandler := connect.NewUnaryHandler(
		DeviceServiceCommandsProcedure,
		svc.Commands,
		connect.WithSchema(deviceServiceCommandsMethodDescriptor),
		connect.WithHandlerOptions(opts...),
	)
	deviceServiceDetailsHandler := connect.NewUnaryHandler(
		DeviceServiceDetailsProcedure,
		svc.Details,
		connect.WithSchema(deviceServiceDetailsMethodDescriptor),
		connect.WithHandlerOptions(opts...),
	)
	deviceServiceRunHandler := connect.NewBidiStreamHandler(
		DeviceServiceRunProcedure,
		svc.Run,
		connect.WithSchema(deviceServiceRunMethodDescriptor),
		connect.WithHandlerOptions(opts...),
	)
	return "/dutctl.v1.DeviceService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case DeviceServiceListProcedure:
			deviceServiceListHandler.ServeHTTP(w, r)
		case DeviceServiceCommandsProcedure:
			deviceServiceCommandsHandler.ServeHTTP(w, r)
		case DeviceServiceDetailsProcedure:
			deviceServiceDetailsHandler.ServeHTTP(w, r)
		case DeviceServiceRunProcedure:
			deviceServiceRunHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

// UnimplementedDeviceServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedDeviceServiceHandler struct{}

func (UnimplementedDeviceServiceHandler) List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("dutctl.v1.DeviceService.List is not implemented"))
}

func (UnimplementedDeviceServiceHandler) Commands(context.Context, *connect.Request[v1.CommandsRequest]) (*connect.Response[v1.CommandsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("dutctl.v1.DeviceService.Commands is not implemented"))
}

func (UnimplementedDeviceServiceHandler) Details(context.Context, *connect.Request[v1.DetailsRequest]) (*connect.Response[v1.DetailsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("dutctl.v1.DeviceService.Details is not implemented"))
}

func (UnimplementedDeviceServiceHandler) Run(context.Context, *connect.BidiStream[v1.RunRequest, v1.RunResponse]) error {
	return connect.NewError(connect.CodeUnimplemented, errors.New("dutctl.v1.DeviceService.Run is not implemented"))
}

// RelayServiceClient is a client for the dutctl.v1.RelayService service.
type RelayServiceClient interface {
	Register(context.Context, *connect.Request[v1.RegisterRequest]) (*connect.Response[v1.RegisterResponse], error)
}

// NewRelayServiceClient constructs a client for the dutctl.v1.RelayService service. By default, it
// uses the Connect protocol with the binary Protobuf Codec, asks for gzipped responses, and sends
// uncompressed requests. To use the gRPC or gRPC-Web protocols, supply the connect.WithGRPC() or
// connect.WithGRPCWeb() options.
//
// The URL supplied here should be the base URL for the Connect or gRPC server (for example,
// http://api.acme.com or https://acme.com/grpc).
func NewRelayServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RelayServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	return &relayServiceClient{
		register: connect.NewClient[v1.RegisterRequest, v1.RegisterResponse](
			httpClient,
			baseURL+RelayServiceRegisterProcedure,
			connect.WithSchema(relayServiceRegisterMethodDescriptor),
			connect.WithClientOptions(opts...),
		),
	}
}

// relayServiceClient implements RelayServiceClient.
type relayServiceClient struct {
	register *connect.Client[v1.RegisterRequest, v1.RegisterResponse]
}

// Register calls dutctl.v1.RelayService.Register.
func (c *relayServiceClient) Register(ctx context.Context, req *connect.Request[v1.RegisterRequest]) (*connect.Response[v1.RegisterResponse], error) {
	return c.register.CallUnary(ctx, req)
}

// RelayServiceHandler is an implementation of the dutctl.v1.RelayService service.
type RelayServiceHandler interface {
	Register(context.Context, *connect.Request[v1.RegisterRequest]) (*connect.Response[v1.RegisterResponse], error)
}

// NewRelayServiceHandler builds an HTTP handler from the service implementation. It returns the
// path on which to mount the handler and the handler itself.
//
// By default, handlers support the Connect, gRPC, and gRPC-Web protocols with the binary Protobuf
// and JSON codecs. They also support gzip compression.
func NewRelayServiceHandler(svc RelayServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	relayServiceRegisterHandler := connect.NewUnaryHandler(
		RelayServiceRegisterProcedure,
		svc.Register,
		connect.WithSchema(relayServiceRegisterMethodDescriptor),
		connect.WithHandlerOptions(opts...),
	)
	return "/dutctl.v1.RelayService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case RelayServiceRegisterProcedure:
			relayServiceRegisterHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

// UnimplementedRelayServiceHandler returns CodeUnimplemented from all methods.
type UnimplementedRelayServiceHandler struct{}

func (UnimplementedRelayServiceHandler) Register(context.Context, *connect.Request[v1.RegisterRequest]) (*connect.Response[v1.RegisterResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("dutctl.v1.RelayService.Register is not implemented"))
}
