// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: xyz/block/ftl/language/v1/commands.proto

package languagepbconnect

import (
	connect "connectrpc.com/connect"
	context "context"
	errors "errors"
	v1 "github.com/block/ftl/backend/protos/xyz/block/ftl/language/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.IsAtLeastVersion1_13_0

const (
	// LanguageCommandServiceName is the fully-qualified name of the LanguageCommandService service.
	LanguageCommandServiceName = "xyz.block.ftl.language.v1.LanguageCommandService"
)

// 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 (
	// LanguageCommandServiceGetNewModuleFlagsProcedure is the fully-qualified name of the
	// LanguageCommandService's GetNewModuleFlags RPC.
	LanguageCommandServiceGetNewModuleFlagsProcedure = "/xyz.block.ftl.language.v1.LanguageCommandService/GetNewModuleFlags"
	// LanguageCommandServiceNewModuleProcedure is the fully-qualified name of the
	// LanguageCommandService's NewModule RPC.
	LanguageCommandServiceNewModuleProcedure = "/xyz.block.ftl.language.v1.LanguageCommandService/NewModule"
	// LanguageCommandServiceGetModuleConfigDefaultsProcedure is the fully-qualified name of the
	// LanguageCommandService's GetModuleConfigDefaults RPC.
	LanguageCommandServiceGetModuleConfigDefaultsProcedure = "/xyz.block.ftl.language.v1.LanguageCommandService/GetModuleConfigDefaults"
	// LanguageCommandServiceGetSQLInterfacesProcedure is the fully-qualified name of the
	// LanguageCommandService's GetSQLInterfaces RPC.
	LanguageCommandServiceGetSQLInterfacesProcedure = "/xyz.block.ftl.language.v1.LanguageCommandService/GetSQLInterfaces"
)

// LanguageCommandServiceClient is a client for the xyz.block.ftl.language.v1.LanguageCommandService
// service.
type LanguageCommandServiceClient interface {
	// Get language specific flags that can be used to create a new module.
	GetNewModuleFlags(context.Context, *connect.Request[v1.GetNewModuleFlagsRequest]) (*connect.Response[v1.GetNewModuleFlagsResponse], error)
	// Generates files for a new module with the requested name
	NewModule(context.Context, *connect.Request[v1.NewModuleRequest]) (*connect.Response[v1.NewModuleResponse], error)
	// Provide default values for ModuleConfig for values that are not configured in the ftl.toml file.
	GetModuleConfigDefaults(context.Context, *connect.Request[v1.GetModuleConfigDefaultsRequest]) (*connect.Response[v1.GetModuleConfigDefaultsResponse], error)
	// Get generated language-specific interface for SQL verbs and types.
	GetSQLInterfaces(context.Context, *connect.Request[v1.GetSQLInterfacesRequest]) (*connect.Response[v1.GetSQLInterfacesResponse], error)
}

// NewLanguageCommandServiceClient constructs a client for the
// xyz.block.ftl.language.v1.LanguageCommandService 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 NewLanguageCommandServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) LanguageCommandServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	languageCommandServiceMethods := v1.File_xyz_block_ftl_language_v1_commands_proto.Services().ByName("LanguageCommandService").Methods()
	return &languageCommandServiceClient{
		getNewModuleFlags: connect.NewClient[v1.GetNewModuleFlagsRequest, v1.GetNewModuleFlagsResponse](
			httpClient,
			baseURL+LanguageCommandServiceGetNewModuleFlagsProcedure,
			connect.WithSchema(languageCommandServiceMethods.ByName("GetNewModuleFlags")),
			connect.WithClientOptions(opts...),
		),
		newModule: connect.NewClient[v1.NewModuleRequest, v1.NewModuleResponse](
			httpClient,
			baseURL+LanguageCommandServiceNewModuleProcedure,
			connect.WithSchema(languageCommandServiceMethods.ByName("NewModule")),
			connect.WithClientOptions(opts...),
		),
		getModuleConfigDefaults: connect.NewClient[v1.GetModuleConfigDefaultsRequest, v1.GetModuleConfigDefaultsResponse](
			httpClient,
			baseURL+LanguageCommandServiceGetModuleConfigDefaultsProcedure,
			connect.WithSchema(languageCommandServiceMethods.ByName("GetModuleConfigDefaults")),
			connect.WithClientOptions(opts...),
		),
		getSQLInterfaces: connect.NewClient[v1.GetSQLInterfacesRequest, v1.GetSQLInterfacesResponse](
			httpClient,
			baseURL+LanguageCommandServiceGetSQLInterfacesProcedure,
			connect.WithSchema(languageCommandServiceMethods.ByName("GetSQLInterfaces")),
			connect.WithClientOptions(opts...),
		),
	}
}

// languageCommandServiceClient implements LanguageCommandServiceClient.
type languageCommandServiceClient struct {
	getNewModuleFlags       *connect.Client[v1.GetNewModuleFlagsRequest, v1.GetNewModuleFlagsResponse]
	newModule               *connect.Client[v1.NewModuleRequest, v1.NewModuleResponse]
	getModuleConfigDefaults *connect.Client[v1.GetModuleConfigDefaultsRequest, v1.GetModuleConfigDefaultsResponse]
	getSQLInterfaces        *connect.Client[v1.GetSQLInterfacesRequest, v1.GetSQLInterfacesResponse]
}

// GetNewModuleFlags calls xyz.block.ftl.language.v1.LanguageCommandService.GetNewModuleFlags.
func (c *languageCommandServiceClient) GetNewModuleFlags(ctx context.Context, req *connect.Request[v1.GetNewModuleFlagsRequest]) (*connect.Response[v1.GetNewModuleFlagsResponse], error) {
	return c.getNewModuleFlags.CallUnary(ctx, req)
}

// NewModule calls xyz.block.ftl.language.v1.LanguageCommandService.NewModule.
func (c *languageCommandServiceClient) NewModule(ctx context.Context, req *connect.Request[v1.NewModuleRequest]) (*connect.Response[v1.NewModuleResponse], error) {
	return c.newModule.CallUnary(ctx, req)
}

// GetModuleConfigDefaults calls
// xyz.block.ftl.language.v1.LanguageCommandService.GetModuleConfigDefaults.
func (c *languageCommandServiceClient) GetModuleConfigDefaults(ctx context.Context, req *connect.Request[v1.GetModuleConfigDefaultsRequest]) (*connect.Response[v1.GetModuleConfigDefaultsResponse], error) {
	return c.getModuleConfigDefaults.CallUnary(ctx, req)
}

// GetSQLInterfaces calls xyz.block.ftl.language.v1.LanguageCommandService.GetSQLInterfaces.
func (c *languageCommandServiceClient) GetSQLInterfaces(ctx context.Context, req *connect.Request[v1.GetSQLInterfacesRequest]) (*connect.Response[v1.GetSQLInterfacesResponse], error) {
	return c.getSQLInterfaces.CallUnary(ctx, req)
}

// LanguageCommandServiceHandler is an implementation of the
// xyz.block.ftl.language.v1.LanguageCommandService service.
type LanguageCommandServiceHandler interface {
	// Get language specific flags that can be used to create a new module.
	GetNewModuleFlags(context.Context, *connect.Request[v1.GetNewModuleFlagsRequest]) (*connect.Response[v1.GetNewModuleFlagsResponse], error)
	// Generates files for a new module with the requested name
	NewModule(context.Context, *connect.Request[v1.NewModuleRequest]) (*connect.Response[v1.NewModuleResponse], error)
	// Provide default values for ModuleConfig for values that are not configured in the ftl.toml file.
	GetModuleConfigDefaults(context.Context, *connect.Request[v1.GetModuleConfigDefaultsRequest]) (*connect.Response[v1.GetModuleConfigDefaultsResponse], error)
	// Get generated language-specific interface for SQL verbs and types.
	GetSQLInterfaces(context.Context, *connect.Request[v1.GetSQLInterfacesRequest]) (*connect.Response[v1.GetSQLInterfacesResponse], error)
}

// NewLanguageCommandServiceHandler 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 NewLanguageCommandServiceHandler(svc LanguageCommandServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	languageCommandServiceMethods := v1.File_xyz_block_ftl_language_v1_commands_proto.Services().ByName("LanguageCommandService").Methods()
	languageCommandServiceGetNewModuleFlagsHandler := connect.NewUnaryHandler(
		LanguageCommandServiceGetNewModuleFlagsProcedure,
		svc.GetNewModuleFlags,
		connect.WithSchema(languageCommandServiceMethods.ByName("GetNewModuleFlags")),
		connect.WithHandlerOptions(opts...),
	)
	languageCommandServiceNewModuleHandler := connect.NewUnaryHandler(
		LanguageCommandServiceNewModuleProcedure,
		svc.NewModule,
		connect.WithSchema(languageCommandServiceMethods.ByName("NewModule")),
		connect.WithHandlerOptions(opts...),
	)
	languageCommandServiceGetModuleConfigDefaultsHandler := connect.NewUnaryHandler(
		LanguageCommandServiceGetModuleConfigDefaultsProcedure,
		svc.GetModuleConfigDefaults,
		connect.WithSchema(languageCommandServiceMethods.ByName("GetModuleConfigDefaults")),
		connect.WithHandlerOptions(opts...),
	)
	languageCommandServiceGetSQLInterfacesHandler := connect.NewUnaryHandler(
		LanguageCommandServiceGetSQLInterfacesProcedure,
		svc.GetSQLInterfaces,
		connect.WithSchema(languageCommandServiceMethods.ByName("GetSQLInterfaces")),
		connect.WithHandlerOptions(opts...),
	)
	return "/xyz.block.ftl.language.v1.LanguageCommandService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case LanguageCommandServiceGetNewModuleFlagsProcedure:
			languageCommandServiceGetNewModuleFlagsHandler.ServeHTTP(w, r)
		case LanguageCommandServiceNewModuleProcedure:
			languageCommandServiceNewModuleHandler.ServeHTTP(w, r)
		case LanguageCommandServiceGetModuleConfigDefaultsProcedure:
			languageCommandServiceGetModuleConfigDefaultsHandler.ServeHTTP(w, r)
		case LanguageCommandServiceGetSQLInterfacesProcedure:
			languageCommandServiceGetSQLInterfacesHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

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

func (UnimplementedLanguageCommandServiceHandler) GetNewModuleFlags(context.Context, *connect.Request[v1.GetNewModuleFlagsRequest]) (*connect.Response[v1.GetNewModuleFlagsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("xyz.block.ftl.language.v1.LanguageCommandService.GetNewModuleFlags is not implemented"))
}

func (UnimplementedLanguageCommandServiceHandler) NewModule(context.Context, *connect.Request[v1.NewModuleRequest]) (*connect.Response[v1.NewModuleResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("xyz.block.ftl.language.v1.LanguageCommandService.NewModule is not implemented"))
}

func (UnimplementedLanguageCommandServiceHandler) GetModuleConfigDefaults(context.Context, *connect.Request[v1.GetModuleConfigDefaultsRequest]) (*connect.Response[v1.GetModuleConfigDefaultsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("xyz.block.ftl.language.v1.LanguageCommandService.GetModuleConfigDefaults is not implemented"))
}

func (UnimplementedLanguageCommandServiceHandler) GetSQLInterfaces(context.Context, *connect.Request[v1.GetSQLInterfacesRequest]) (*connect.Response[v1.GetSQLInterfacesResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("xyz.block.ftl.language.v1.LanguageCommandService.GetSQLInterfaces is not implemented"))
}
