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

package varsv1connect

import (
	connect "connectrpc.com/connect"
	context "context"
	errors "errors"
	v1 "go.autokitteh.dev/autokitteh/proto/gen/go/autokitteh/vars/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 (
	// VarsServiceName is the fully-qualified name of the VarsService service.
	VarsServiceName = "autokitteh.vars.v1.VarsService"
)

// 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 (
	// VarsServiceSetProcedure is the fully-qualified name of the VarsService's Set RPC.
	VarsServiceSetProcedure = "/autokitteh.vars.v1.VarsService/Set"
	// VarsServiceGetProcedure is the fully-qualified name of the VarsService's Get RPC.
	VarsServiceGetProcedure = "/autokitteh.vars.v1.VarsService/Get"
	// VarsServiceDeleteProcedure is the fully-qualified name of the VarsService's Delete RPC.
	VarsServiceDeleteProcedure = "/autokitteh.vars.v1.VarsService/Delete"
	// VarsServiceFindActiveConnectionIDsProcedure is the fully-qualified name of the VarsService's
	// FindActiveConnectionIDs RPC.
	VarsServiceFindActiveConnectionIDsProcedure = "/autokitteh.vars.v1.VarsService/FindActiveConnectionIDs"
)

// VarsServiceClient is a client for the autokitteh.vars.v1.VarsService service.
type VarsServiceClient interface {
	Set(context.Context, *connect.Request[v1.SetRequest]) (*connect.Response[v1.SetResponse], 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)
	// Specific for integrations.
	FindActiveConnectionIDs(context.Context, *connect.Request[v1.FindActiveConnectionIDsRequest]) (*connect.Response[v1.FindActiveConnectionIDsResponse], error)
}

// NewVarsServiceClient constructs a client for the autokitteh.vars.v1.VarsService 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 NewVarsServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) VarsServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	return &varsServiceClient{
		set: connect.NewClient[v1.SetRequest, v1.SetResponse](
			httpClient,
			baseURL+VarsServiceSetProcedure,
			opts...,
		),
		get: connect.NewClient[v1.GetRequest, v1.GetResponse](
			httpClient,
			baseURL+VarsServiceGetProcedure,
			opts...,
		),
		delete: connect.NewClient[v1.DeleteRequest, v1.DeleteResponse](
			httpClient,
			baseURL+VarsServiceDeleteProcedure,
			opts...,
		),
		findActiveConnectionIDs: connect.NewClient[v1.FindActiveConnectionIDsRequest, v1.FindActiveConnectionIDsResponse](
			httpClient,
			baseURL+VarsServiceFindActiveConnectionIDsProcedure,
			opts...,
		),
	}
}

// varsServiceClient implements VarsServiceClient.
type varsServiceClient struct {
	set                     *connect.Client[v1.SetRequest, v1.SetResponse]
	get                     *connect.Client[v1.GetRequest, v1.GetResponse]
	delete                  *connect.Client[v1.DeleteRequest, v1.DeleteResponse]
	findActiveConnectionIDs *connect.Client[v1.FindActiveConnectionIDsRequest, v1.FindActiveConnectionIDsResponse]
}

// Set calls autokitteh.vars.v1.VarsService.Set.
func (c *varsServiceClient) Set(ctx context.Context, req *connect.Request[v1.SetRequest]) (*connect.Response[v1.SetResponse], error) {
	return c.set.CallUnary(ctx, req)
}

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

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

// FindActiveConnectionIDs calls autokitteh.vars.v1.VarsService.FindActiveConnectionIDs.
func (c *varsServiceClient) FindActiveConnectionIDs(ctx context.Context, req *connect.Request[v1.FindActiveConnectionIDsRequest]) (*connect.Response[v1.FindActiveConnectionIDsResponse], error) {
	return c.findActiveConnectionIDs.CallUnary(ctx, req)
}

// VarsServiceHandler is an implementation of the autokitteh.vars.v1.VarsService service.
type VarsServiceHandler interface {
	Set(context.Context, *connect.Request[v1.SetRequest]) (*connect.Response[v1.SetResponse], 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)
	// Specific for integrations.
	FindActiveConnectionIDs(context.Context, *connect.Request[v1.FindActiveConnectionIDsRequest]) (*connect.Response[v1.FindActiveConnectionIDsResponse], error)
}

// NewVarsServiceHandler 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 NewVarsServiceHandler(svc VarsServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	varsServiceSetHandler := connect.NewUnaryHandler(
		VarsServiceSetProcedure,
		svc.Set,
		opts...,
	)
	varsServiceGetHandler := connect.NewUnaryHandler(
		VarsServiceGetProcedure,
		svc.Get,
		opts...,
	)
	varsServiceDeleteHandler := connect.NewUnaryHandler(
		VarsServiceDeleteProcedure,
		svc.Delete,
		opts...,
	)
	varsServiceFindActiveConnectionIDsHandler := connect.NewUnaryHandler(
		VarsServiceFindActiveConnectionIDsProcedure,
		svc.FindActiveConnectionIDs,
		opts...,
	)
	return "/autokitteh.vars.v1.VarsService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case VarsServiceSetProcedure:
			varsServiceSetHandler.ServeHTTP(w, r)
		case VarsServiceGetProcedure:
			varsServiceGetHandler.ServeHTTP(w, r)
		case VarsServiceDeleteProcedure:
			varsServiceDeleteHandler.ServeHTTP(w, r)
		case VarsServiceFindActiveConnectionIDsProcedure:
			varsServiceFindActiveConnectionIDsHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

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

func (UnimplementedVarsServiceHandler) Set(context.Context, *connect.Request[v1.SetRequest]) (*connect.Response[v1.SetResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.vars.v1.VarsService.Set is not implemented"))
}

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

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

func (UnimplementedVarsServiceHandler) FindActiveConnectionIDs(context.Context, *connect.Request[v1.FindActiveConnectionIDsRequest]) (*connect.Response[v1.FindActiveConnectionIDsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.vars.v1.VarsService.FindActiveConnectionIDs is not implemented"))
}
