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

package triggersv1connect

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

// 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 (
	// TriggersServiceCreateProcedure is the fully-qualified name of the TriggersService's Create RPC.
	TriggersServiceCreateProcedure = "/autokitteh.triggers.v1.TriggersService/Create"
	// TriggersServiceUpdateProcedure is the fully-qualified name of the TriggersService's Update RPC.
	TriggersServiceUpdateProcedure = "/autokitteh.triggers.v1.TriggersService/Update"
	// TriggersServiceDeleteProcedure is the fully-qualified name of the TriggersService's Delete RPC.
	TriggersServiceDeleteProcedure = "/autokitteh.triggers.v1.TriggersService/Delete"
	// TriggersServiceGetProcedure is the fully-qualified name of the TriggersService's Get RPC.
	TriggersServiceGetProcedure = "/autokitteh.triggers.v1.TriggersService/Get"
	// TriggersServiceListProcedure is the fully-qualified name of the TriggersService's List RPC.
	TriggersServiceListProcedure = "/autokitteh.triggers.v1.TriggersService/List"
)

// TriggersServiceClient is a client for the autokitteh.triggers.v1.TriggersService service.
type TriggersServiceClient interface {
	Create(context.Context, *connect.Request[v1.CreateRequest]) (*connect.Response[v1.CreateResponse], error)
	Update(context.Context, *connect.Request[v1.UpdateRequest]) (*connect.Response[v1.UpdateResponse], error)
	Delete(context.Context, *connect.Request[v1.DeleteRequest]) (*connect.Response[v1.DeleteResponse], 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)
}

// NewTriggersServiceClient constructs a client for the autokitteh.triggers.v1.TriggersService
// 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 NewTriggersServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) TriggersServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	return &triggersServiceClient{
		create: connect.NewClient[v1.CreateRequest, v1.CreateResponse](
			httpClient,
			baseURL+TriggersServiceCreateProcedure,
			opts...,
		),
		update: connect.NewClient[v1.UpdateRequest, v1.UpdateResponse](
			httpClient,
			baseURL+TriggersServiceUpdateProcedure,
			opts...,
		),
		delete: connect.NewClient[v1.DeleteRequest, v1.DeleteResponse](
			httpClient,
			baseURL+TriggersServiceDeleteProcedure,
			opts...,
		),
		get: connect.NewClient[v1.GetRequest, v1.GetResponse](
			httpClient,
			baseURL+TriggersServiceGetProcedure,
			opts...,
		),
		list: connect.NewClient[v1.ListRequest, v1.ListResponse](
			httpClient,
			baseURL+TriggersServiceListProcedure,
			opts...,
		),
	}
}

// triggersServiceClient implements TriggersServiceClient.
type triggersServiceClient struct {
	create *connect.Client[v1.CreateRequest, v1.CreateResponse]
	update *connect.Client[v1.UpdateRequest, v1.UpdateResponse]
	delete *connect.Client[v1.DeleteRequest, v1.DeleteResponse]
	get    *connect.Client[v1.GetRequest, v1.GetResponse]
	list   *connect.Client[v1.ListRequest, v1.ListResponse]
}

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

// Update calls autokitteh.triggers.v1.TriggersService.Update.
func (c *triggersServiceClient) Update(ctx context.Context, req *connect.Request[v1.UpdateRequest]) (*connect.Response[v1.UpdateResponse], error) {
	return c.update.CallUnary(ctx, req)
}

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

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

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

// TriggersServiceHandler is an implementation of the autokitteh.triggers.v1.TriggersService
// service.
type TriggersServiceHandler interface {
	Create(context.Context, *connect.Request[v1.CreateRequest]) (*connect.Response[v1.CreateResponse], error)
	Update(context.Context, *connect.Request[v1.UpdateRequest]) (*connect.Response[v1.UpdateResponse], error)
	Delete(context.Context, *connect.Request[v1.DeleteRequest]) (*connect.Response[v1.DeleteResponse], 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)
}

// NewTriggersServiceHandler 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 NewTriggersServiceHandler(svc TriggersServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	triggersServiceCreateHandler := connect.NewUnaryHandler(
		TriggersServiceCreateProcedure,
		svc.Create,
		opts...,
	)
	triggersServiceUpdateHandler := connect.NewUnaryHandler(
		TriggersServiceUpdateProcedure,
		svc.Update,
		opts...,
	)
	triggersServiceDeleteHandler := connect.NewUnaryHandler(
		TriggersServiceDeleteProcedure,
		svc.Delete,
		opts...,
	)
	triggersServiceGetHandler := connect.NewUnaryHandler(
		TriggersServiceGetProcedure,
		svc.Get,
		opts...,
	)
	triggersServiceListHandler := connect.NewUnaryHandler(
		TriggersServiceListProcedure,
		svc.List,
		opts...,
	)
	return "/autokitteh.triggers.v1.TriggersService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case TriggersServiceCreateProcedure:
			triggersServiceCreateHandler.ServeHTTP(w, r)
		case TriggersServiceUpdateProcedure:
			triggersServiceUpdateHandler.ServeHTTP(w, r)
		case TriggersServiceDeleteProcedure:
			triggersServiceDeleteHandler.ServeHTTP(w, r)
		case TriggersServiceGetProcedure:
			triggersServiceGetHandler.ServeHTTP(w, r)
		case TriggersServiceListProcedure:
			triggersServiceListHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

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

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

func (UnimplementedTriggersServiceHandler) Update(context.Context, *connect.Request[v1.UpdateRequest]) (*connect.Response[v1.UpdateResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.triggers.v1.TriggersService.Update is not implemented"))
}

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

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

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