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

package deploymentsv1connect

import (
	connect "connectrpc.com/connect"
	context "context"
	errors "errors"
	v1 "go.autokitteh.dev/autokitteh/proto/gen/go/autokitteh/deployments/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.IsAtLeastVersion0_1_0

const (
	// DeploymentsServiceName is the fully-qualified name of the DeploymentsService service.
	DeploymentsServiceName = "autokitteh.deployments.v1.DeploymentsService"
)

// 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 (
	// DeploymentsServiceCreateProcedure is the fully-qualified name of the DeploymentsService's Create
	// RPC.
	DeploymentsServiceCreateProcedure = "/autokitteh.deployments.v1.DeploymentsService/Create"
	// DeploymentsServiceActivateProcedure is the fully-qualified name of the DeploymentsService's
	// Activate RPC.
	DeploymentsServiceActivateProcedure = "/autokitteh.deployments.v1.DeploymentsService/Activate"
	// DeploymentsServiceDeactivateProcedure is the fully-qualified name of the DeploymentsService's
	// Deactivate RPC.
	DeploymentsServiceDeactivateProcedure = "/autokitteh.deployments.v1.DeploymentsService/Deactivate"
	// DeploymentsServiceTestProcedure is the fully-qualified name of the DeploymentsService's Test RPC.
	DeploymentsServiceTestProcedure = "/autokitteh.deployments.v1.DeploymentsService/Test"
	// DeploymentsServiceListProcedure is the fully-qualified name of the DeploymentsService's List RPC.
	DeploymentsServiceListProcedure = "/autokitteh.deployments.v1.DeploymentsService/List"
	// DeploymentsServiceGetProcedure is the fully-qualified name of the DeploymentsService's Get RPC.
	DeploymentsServiceGetProcedure = "/autokitteh.deployments.v1.DeploymentsService/Get"
	// DeploymentsServiceDeleteProcedure is the fully-qualified name of the DeploymentsService's Delete
	// RPC.
	DeploymentsServiceDeleteProcedure = "/autokitteh.deployments.v1.DeploymentsService/Delete"
)

// DeploymentsServiceClient is a client for the autokitteh.deployments.v1.DeploymentsService
// service.
type DeploymentsServiceClient interface {
	Create(context.Context, *connect.Request[v1.CreateRequest]) (*connect.Response[v1.CreateResponse], error)
	// Activate a deployment, automatically drains all others.
	Activate(context.Context, *connect.Request[v1.ActivateRequest]) (*connect.Response[v1.ActivateResponse], error)
	// Deactivate a deployment. If deployment has any active sessions,
	// deployment will be drained first.
	Deactivate(context.Context, *connect.Request[v1.DeactivateRequest]) (*connect.Response[v1.DeactivateResponse], error)
	Test(context.Context, *connect.Request[v1.TestRequest]) (*connect.Response[v1.TestResponse], error)
	List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
	Get(context.Context, *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error)
	Delete(context.Context, *connect.Request[v1.DeleteRequest]) (*connect.Response[v1.DeleteResponse], error)
}

// NewDeploymentsServiceClient constructs a client for the
// autokitteh.deployments.v1.DeploymentsService 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 NewDeploymentsServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) DeploymentsServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	return &deploymentsServiceClient{
		create: connect.NewClient[v1.CreateRequest, v1.CreateResponse](
			httpClient,
			baseURL+DeploymentsServiceCreateProcedure,
			opts...,
		),
		activate: connect.NewClient[v1.ActivateRequest, v1.ActivateResponse](
			httpClient,
			baseURL+DeploymentsServiceActivateProcedure,
			opts...,
		),
		deactivate: connect.NewClient[v1.DeactivateRequest, v1.DeactivateResponse](
			httpClient,
			baseURL+DeploymentsServiceDeactivateProcedure,
			opts...,
		),
		test: connect.NewClient[v1.TestRequest, v1.TestResponse](
			httpClient,
			baseURL+DeploymentsServiceTestProcedure,
			opts...,
		),
		list: connect.NewClient[v1.ListRequest, v1.ListResponse](
			httpClient,
			baseURL+DeploymentsServiceListProcedure,
			opts...,
		),
		get: connect.NewClient[v1.GetRequest, v1.GetResponse](
			httpClient,
			baseURL+DeploymentsServiceGetProcedure,
			opts...,
		),
		delete: connect.NewClient[v1.DeleteRequest, v1.DeleteResponse](
			httpClient,
			baseURL+DeploymentsServiceDeleteProcedure,
			opts...,
		),
	}
}

// deploymentsServiceClient implements DeploymentsServiceClient.
type deploymentsServiceClient struct {
	create     *connect.Client[v1.CreateRequest, v1.CreateResponse]
	activate   *connect.Client[v1.ActivateRequest, v1.ActivateResponse]
	deactivate *connect.Client[v1.DeactivateRequest, v1.DeactivateResponse]
	test       *connect.Client[v1.TestRequest, v1.TestResponse]
	list       *connect.Client[v1.ListRequest, v1.ListResponse]
	get        *connect.Client[v1.GetRequest, v1.GetResponse]
	delete     *connect.Client[v1.DeleteRequest, v1.DeleteResponse]
}

// Create calls autokitteh.deployments.v1.DeploymentsService.Create.
func (c *deploymentsServiceClient) Create(ctx context.Context, req *connect.Request[v1.CreateRequest]) (*connect.Response[v1.CreateResponse], error) {
	return c.create.CallUnary(ctx, req)
}

// Activate calls autokitteh.deployments.v1.DeploymentsService.Activate.
func (c *deploymentsServiceClient) Activate(ctx context.Context, req *connect.Request[v1.ActivateRequest]) (*connect.Response[v1.ActivateResponse], error) {
	return c.activate.CallUnary(ctx, req)
}

// Deactivate calls autokitteh.deployments.v1.DeploymentsService.Deactivate.
func (c *deploymentsServiceClient) Deactivate(ctx context.Context, req *connect.Request[v1.DeactivateRequest]) (*connect.Response[v1.DeactivateResponse], error) {
	return c.deactivate.CallUnary(ctx, req)
}

// Test calls autokitteh.deployments.v1.DeploymentsService.Test.
func (c *deploymentsServiceClient) Test(ctx context.Context, req *connect.Request[v1.TestRequest]) (*connect.Response[v1.TestResponse], error) {
	return c.test.CallUnary(ctx, req)
}

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

// Get calls autokitteh.deployments.v1.DeploymentsService.Get.
func (c *deploymentsServiceClient) Get(ctx context.Context, req *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error) {
	return c.get.CallUnary(ctx, req)
}

// Delete calls autokitteh.deployments.v1.DeploymentsService.Delete.
func (c *deploymentsServiceClient) Delete(ctx context.Context, req *connect.Request[v1.DeleteRequest]) (*connect.Response[v1.DeleteResponse], error) {
	return c.delete.CallUnary(ctx, req)
}

// DeploymentsServiceHandler is an implementation of the
// autokitteh.deployments.v1.DeploymentsService service.
type DeploymentsServiceHandler interface {
	Create(context.Context, *connect.Request[v1.CreateRequest]) (*connect.Response[v1.CreateResponse], error)
	// Activate a deployment, automatically drains all others.
	Activate(context.Context, *connect.Request[v1.ActivateRequest]) (*connect.Response[v1.ActivateResponse], error)
	// Deactivate a deployment. If deployment has any active sessions,
	// deployment will be drained first.
	Deactivate(context.Context, *connect.Request[v1.DeactivateRequest]) (*connect.Response[v1.DeactivateResponse], error)
	Test(context.Context, *connect.Request[v1.TestRequest]) (*connect.Response[v1.TestResponse], error)
	List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
	Get(context.Context, *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error)
	Delete(context.Context, *connect.Request[v1.DeleteRequest]) (*connect.Response[v1.DeleteResponse], error)
}

// NewDeploymentsServiceHandler 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 NewDeploymentsServiceHandler(svc DeploymentsServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	deploymentsServiceCreateHandler := connect.NewUnaryHandler(
		DeploymentsServiceCreateProcedure,
		svc.Create,
		opts...,
	)
	deploymentsServiceActivateHandler := connect.NewUnaryHandler(
		DeploymentsServiceActivateProcedure,
		svc.Activate,
		opts...,
	)
	deploymentsServiceDeactivateHandler := connect.NewUnaryHandler(
		DeploymentsServiceDeactivateProcedure,
		svc.Deactivate,
		opts...,
	)
	deploymentsServiceTestHandler := connect.NewUnaryHandler(
		DeploymentsServiceTestProcedure,
		svc.Test,
		opts...,
	)
	deploymentsServiceListHandler := connect.NewUnaryHandler(
		DeploymentsServiceListProcedure,
		svc.List,
		opts...,
	)
	deploymentsServiceGetHandler := connect.NewUnaryHandler(
		DeploymentsServiceGetProcedure,
		svc.Get,
		opts...,
	)
	deploymentsServiceDeleteHandler := connect.NewUnaryHandler(
		DeploymentsServiceDeleteProcedure,
		svc.Delete,
		opts...,
	)
	return "/autokitteh.deployments.v1.DeploymentsService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case DeploymentsServiceCreateProcedure:
			deploymentsServiceCreateHandler.ServeHTTP(w, r)
		case DeploymentsServiceActivateProcedure:
			deploymentsServiceActivateHandler.ServeHTTP(w, r)
		case DeploymentsServiceDeactivateProcedure:
			deploymentsServiceDeactivateHandler.ServeHTTP(w, r)
		case DeploymentsServiceTestProcedure:
			deploymentsServiceTestHandler.ServeHTTP(w, r)
		case DeploymentsServiceListProcedure:
			deploymentsServiceListHandler.ServeHTTP(w, r)
		case DeploymentsServiceGetProcedure:
			deploymentsServiceGetHandler.ServeHTTP(w, r)
		case DeploymentsServiceDeleteProcedure:
			deploymentsServiceDeleteHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

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

func (UnimplementedDeploymentsServiceHandler) Create(context.Context, *connect.Request[v1.CreateRequest]) (*connect.Response[v1.CreateResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.deployments.v1.DeploymentsService.Create is not implemented"))
}

func (UnimplementedDeploymentsServiceHandler) Activate(context.Context, *connect.Request[v1.ActivateRequest]) (*connect.Response[v1.ActivateResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.deployments.v1.DeploymentsService.Activate is not implemented"))
}

func (UnimplementedDeploymentsServiceHandler) Deactivate(context.Context, *connect.Request[v1.DeactivateRequest]) (*connect.Response[v1.DeactivateResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.deployments.v1.DeploymentsService.Deactivate is not implemented"))
}

func (UnimplementedDeploymentsServiceHandler) Test(context.Context, *connect.Request[v1.TestRequest]) (*connect.Response[v1.TestResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.deployments.v1.DeploymentsService.Test is not implemented"))
}

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

func (UnimplementedDeploymentsServiceHandler) Get(context.Context, *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.deployments.v1.DeploymentsService.Get is not implemented"))
}

func (UnimplementedDeploymentsServiceHandler) Delete(context.Context, *connect.Request[v1.DeleteRequest]) (*connect.Response[v1.DeleteResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.deployments.v1.DeploymentsService.Delete is not implemented"))
}
