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

package runtimesv1connect

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

// 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 (
	// RuntimesServiceDescribeProcedure is the fully-qualified name of the RuntimesService's Describe
	// RPC.
	RuntimesServiceDescribeProcedure = "/autokitteh.runtimes.v1.RuntimesService/Describe"
	// RuntimesServiceListProcedure is the fully-qualified name of the RuntimesService's List RPC.
	RuntimesServiceListProcedure = "/autokitteh.runtimes.v1.RuntimesService/List"
	// RuntimesServiceBuildProcedure is the fully-qualified name of the RuntimesService's Build RPC.
	RuntimesServiceBuildProcedure = "/autokitteh.runtimes.v1.RuntimesService/Build"
	// RuntimesServiceRunProcedure is the fully-qualified name of the RuntimesService's Run RPC.
	RuntimesServiceRunProcedure = "/autokitteh.runtimes.v1.RuntimesService/Run"
)

// RuntimesServiceClient is a client for the autokitteh.runtimes.v1.RuntimesService service.
type RuntimesServiceClient interface {
	Describe(context.Context, *connect.Request[v1.DescribeRequest]) (*connect.Response[v1.DescribeResponse], error)
	List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
	Build(context.Context, *connect.Request[v1.BuildRequest]) (*connect.Response[v1.BuildResponse], error)
	// This is a simplified version that should be used
	// for testing and local runs only.
	Run(context.Context, *connect.Request[v1.RunRequest]) (*connect.ServerStreamForClient[v1.RunResponse], error)
}

// NewRuntimesServiceClient constructs a client for the autokitteh.runtimes.v1.RuntimesService
// 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 NewRuntimesServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RuntimesServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	return &runtimesServiceClient{
		describe: connect.NewClient[v1.DescribeRequest, v1.DescribeResponse](
			httpClient,
			baseURL+RuntimesServiceDescribeProcedure,
			opts...,
		),
		list: connect.NewClient[v1.ListRequest, v1.ListResponse](
			httpClient,
			baseURL+RuntimesServiceListProcedure,
			opts...,
		),
		build: connect.NewClient[v1.BuildRequest, v1.BuildResponse](
			httpClient,
			baseURL+RuntimesServiceBuildProcedure,
			opts...,
		),
		run: connect.NewClient[v1.RunRequest, v1.RunResponse](
			httpClient,
			baseURL+RuntimesServiceRunProcedure,
			opts...,
		),
	}
}

// runtimesServiceClient implements RuntimesServiceClient.
type runtimesServiceClient struct {
	describe *connect.Client[v1.DescribeRequest, v1.DescribeResponse]
	list     *connect.Client[v1.ListRequest, v1.ListResponse]
	build    *connect.Client[v1.BuildRequest, v1.BuildResponse]
	run      *connect.Client[v1.RunRequest, v1.RunResponse]
}

// Describe calls autokitteh.runtimes.v1.RuntimesService.Describe.
func (c *runtimesServiceClient) Describe(ctx context.Context, req *connect.Request[v1.DescribeRequest]) (*connect.Response[v1.DescribeResponse], error) {
	return c.describe.CallUnary(ctx, req)
}

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

// Build calls autokitteh.runtimes.v1.RuntimesService.Build.
func (c *runtimesServiceClient) Build(ctx context.Context, req *connect.Request[v1.BuildRequest]) (*connect.Response[v1.BuildResponse], error) {
	return c.build.CallUnary(ctx, req)
}

// Run calls autokitteh.runtimes.v1.RuntimesService.Run.
func (c *runtimesServiceClient) Run(ctx context.Context, req *connect.Request[v1.RunRequest]) (*connect.ServerStreamForClient[v1.RunResponse], error) {
	return c.run.CallServerStream(ctx, req)
}

// RuntimesServiceHandler is an implementation of the autokitteh.runtimes.v1.RuntimesService
// service.
type RuntimesServiceHandler interface {
	Describe(context.Context, *connect.Request[v1.DescribeRequest]) (*connect.Response[v1.DescribeResponse], error)
	List(context.Context, *connect.Request[v1.ListRequest]) (*connect.Response[v1.ListResponse], error)
	Build(context.Context, *connect.Request[v1.BuildRequest]) (*connect.Response[v1.BuildResponse], error)
	// This is a simplified version that should be used
	// for testing and local runs only.
	Run(context.Context, *connect.Request[v1.RunRequest], *connect.ServerStream[v1.RunResponse]) error
}

// NewRuntimesServiceHandler 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 NewRuntimesServiceHandler(svc RuntimesServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	runtimesServiceDescribeHandler := connect.NewUnaryHandler(
		RuntimesServiceDescribeProcedure,
		svc.Describe,
		opts...,
	)
	runtimesServiceListHandler := connect.NewUnaryHandler(
		RuntimesServiceListProcedure,
		svc.List,
		opts...,
	)
	runtimesServiceBuildHandler := connect.NewUnaryHandler(
		RuntimesServiceBuildProcedure,
		svc.Build,
		opts...,
	)
	runtimesServiceRunHandler := connect.NewServerStreamHandler(
		RuntimesServiceRunProcedure,
		svc.Run,
		opts...,
	)
	return "/autokitteh.runtimes.v1.RuntimesService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case RuntimesServiceDescribeProcedure:
			runtimesServiceDescribeHandler.ServeHTTP(w, r)
		case RuntimesServiceListProcedure:
			runtimesServiceListHandler.ServeHTTP(w, r)
		case RuntimesServiceBuildProcedure:
			runtimesServiceBuildHandler.ServeHTTP(w, r)
		case RuntimesServiceRunProcedure:
			runtimesServiceRunHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

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

func (UnimplementedRuntimesServiceHandler) Describe(context.Context, *connect.Request[v1.DescribeRequest]) (*connect.Response[v1.DescribeResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.runtimes.v1.RuntimesService.Describe is not implemented"))
}

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

func (UnimplementedRuntimesServiceHandler) Build(context.Context, *connect.Request[v1.BuildRequest]) (*connect.Response[v1.BuildResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.runtimes.v1.RuntimesService.Build is not implemented"))
}

func (UnimplementedRuntimesServiceHandler) Run(context.Context, *connect.Request[v1.RunRequest], *connect.ServerStream[v1.RunResponse]) error {
	return connect.NewError(connect.CodeUnimplemented, errors.New("autokitteh.runtimes.v1.RuntimesService.Run is not implemented"))
}
