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

package storev1connect

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

// 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 (
	// StoreServiceMutateProcedure is the fully-qualified name of the StoreService's Mutate RPC.
	StoreServiceMutateProcedure = "/autokitteh.store.v1.StoreService/Mutate"
	// StoreServiceGetProcedure is the fully-qualified name of the StoreService's Get RPC.
	StoreServiceGetProcedure = "/autokitteh.store.v1.StoreService/Get"
	// StoreServiceListProcedure is the fully-qualified name of the StoreService's List RPC.
	StoreServiceListProcedure = "/autokitteh.store.v1.StoreService/List"
)

// StoreServiceClient is a client for the autokitteh.store.v1.StoreService service.
type StoreServiceClient interface {
	Mutate(context.Context, *connect.Request[v1.MutateRequest]) (*connect.Response[v1.MutateResponse], error)
	Get(context.Context, *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error)
	List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
}

// NewStoreServiceClient constructs a client for the autokitteh.store.v1.StoreService 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 NewStoreServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) StoreServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	return &storeServiceClient{
		mutate: connect.NewClient[v1.MutateRequest, v1.MutateResponse](
			httpClient,
			baseURL+StoreServiceMutateProcedure,
			opts...,
		),
		get: connect.NewClient[v1.GetRequest, v1.GetResponse](
			httpClient,
			baseURL+StoreServiceGetProcedure,
			opts...,
		),
		list: connect.NewClient[v1.ListRequest, v1.ListResponse](
			httpClient,
			baseURL+StoreServiceListProcedure,
			opts...,
		),
	}
}

// storeServiceClient implements StoreServiceClient.
type storeServiceClient struct {
	mutate *connect.Client[v1.MutateRequest, v1.MutateResponse]
	get    *connect.Client[v1.GetRequest, v1.GetResponse]
	list   *connect.Client[v1.ListRequest, v1.ListResponse]
}

// Mutate calls autokitteh.store.v1.StoreService.Mutate.
func (c *storeServiceClient) Mutate(ctx context.Context, req *connect.Request[v1.MutateRequest]) (*connect.Response[v1.MutateResponse], error) {
	return c.mutate.CallUnary(ctx, req)
}

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

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

// StoreServiceHandler is an implementation of the autokitteh.store.v1.StoreService service.
type StoreServiceHandler interface {
	Mutate(context.Context, *connect.Request[v1.MutateRequest]) (*connect.Response[v1.MutateResponse], error)
	Get(context.Context, *connect.Request[v1.GetRequest]) (*connect.Response[v1.GetResponse], error)
	List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
}

// NewStoreServiceHandler 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 NewStoreServiceHandler(svc StoreServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	storeServiceMutateHandler := connect.NewUnaryHandler(
		StoreServiceMutateProcedure,
		svc.Mutate,
		opts...,
	)
	storeServiceGetHandler := connect.NewUnaryHandler(
		StoreServiceGetProcedure,
		svc.Get,
		opts...,
	)
	storeServiceListHandler := connect.NewUnaryHandler(
		StoreServiceListProcedure,
		svc.List,
		opts...,
	)
	return "/autokitteh.store.v1.StoreService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case StoreServiceMutateProcedure:
			storeServiceMutateHandler.ServeHTTP(w, r)
		case StoreServiceGetProcedure:
			storeServiceGetHandler.ServeHTTP(w, r)
		case StoreServiceListProcedure:
			storeServiceListHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

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

func (UnimplementedStoreServiceHandler) Mutate(context.Context, *connect.Request[v1.MutateRequest]) (*connect.Response[v1.MutateResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.store.v1.StoreService.Mutate is not implemented"))
}

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

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