// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: signaler_service.proto

package genconnect

import (
	connect "connectrpc.com/connect"
	context "context"
	errors "errors"
	gen "github.com/chathaway-codes/home-sensors/v2/gen"
	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 (
	// SignalerServiceName is the fully-qualified name of the SignalerService service.
	SignalerServiceName = "signaler.SignalerService"
)

// 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 (
	// SignalerServiceCreateAuthTokenProcedure is the fully-qualified name of the SignalerService's
	// CreateAuthToken RPC.
	SignalerServiceCreateAuthTokenProcedure = "/signaler.SignalerService/CreateAuthToken"
	// SignalerServiceListCamerasProcedure is the fully-qualified name of the SignalerService's
	// ListCameras RPC.
	SignalerServiceListCamerasProcedure = "/signaler.SignalerService/ListCameras"
	// SignalerServiceCreateSessionProcedure is the fully-qualified name of the SignalerService's
	// CreateSession RPC.
	SignalerServiceCreateSessionProcedure = "/signaler.SignalerService/CreateSession"
	// SignalerServicePopSessionProcedure is the fully-qualified name of the SignalerService's
	// PopSession RPC.
	SignalerServicePopSessionProcedure = "/signaler.SignalerService/PopSession"
	// SignalerServiceCreateIceMessageProcedure is the fully-qualified name of the SignalerService's
	// CreateIceMessage RPC.
	SignalerServiceCreateIceMessageProcedure = "/signaler.SignalerService/CreateIceMessage"
	// SignalerServicePopIceMessageProcedure is the fully-qualified name of the SignalerService's
	// PopIceMessage RPC.
	SignalerServicePopIceMessageProcedure = "/signaler.SignalerService/PopIceMessage"
	// SignalerServiceCreateSampleProcedure is the fully-qualified name of the SignalerService's
	// CreateSample RPC.
	SignalerServiceCreateSampleProcedure = "/signaler.SignalerService/CreateSample"
	// SignalerServiceListSamplesProcedure is the fully-qualified name of the SignalerService's
	// ListSamples RPC.
	SignalerServiceListSamplesProcedure = "/signaler.SignalerService/ListSamples"
)

// SignalerServiceClient is a client for the signaler.SignalerService service.
type SignalerServiceClient interface {
	CreateAuthToken(context.Context, *connect.Request[gen.CreateAuthTokenRequest]) (*connect.Response[gen.AuthToken], error)
	ListCameras(context.Context, *connect.Request[gen.ListCamerasRequest]) (*connect.Response[gen.ListCamerasResponse], error)
	// CreateSession creates a new session that can be seen bv the provided Camera and Peer.
	//
	// Optionally, wait_for_update can be set to prevent returning until the Camera has seen the
	// session request, populated candidates, and returned a session offer.
	CreateSession(context.Context, *connect.Request[gen.CreateSessionRequest]) (*connect.Response[gen.Session], error)
	// PopSession deletes a session from the list of sessions, and returns it.
	//
	// If there are no sessions, this blocks until one becomes available.
	PopSession(context.Context, *connect.Request[gen.PopSessionRequest]) (*connect.Response[gen.Session], error)
	// CreateIceMessage adds the provided message to the list of candidates.
	CreateIceMessage(context.Context, *connect.Request[gen.CreateIceMessageRequest]) (*connect.Response[gen.IceMessage], error)
	// PopIceCandidate delete a message from the list of messages and returns it.
	//
	// If there are no messages, this blocks until one becomes available.
	PopIceMessage(context.Context, *connect.Request[gen.PopIceMessageRequest]) (*connect.Response[gen.IceMessage], error)
	// CreateSample creates a sample for the given camera.
	// If called without an auth token indicating a camera, an error
	// is returned.
	// TODO: this should be moved to a seperate service
	CreateSample(context.Context, *connect.Request[gen.CreateSampleRequest]) (*connect.Response[gen.Sample], error)
	ListSamples(context.Context, *connect.Request[gen.ListSamplesRequest]) (*connect.Response[gen.ListSamplesResponse], error)
}

// NewSignalerServiceClient constructs a client for the signaler.SignalerService 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 NewSignalerServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) SignalerServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	return &signalerServiceClient{
		createAuthToken: connect.NewClient[gen.CreateAuthTokenRequest, gen.AuthToken](
			httpClient,
			baseURL+SignalerServiceCreateAuthTokenProcedure,
			opts...,
		),
		listCameras: connect.NewClient[gen.ListCamerasRequest, gen.ListCamerasResponse](
			httpClient,
			baseURL+SignalerServiceListCamerasProcedure,
			opts...,
		),
		createSession: connect.NewClient[gen.CreateSessionRequest, gen.Session](
			httpClient,
			baseURL+SignalerServiceCreateSessionProcedure,
			opts...,
		),
		popSession: connect.NewClient[gen.PopSessionRequest, gen.Session](
			httpClient,
			baseURL+SignalerServicePopSessionProcedure,
			opts...,
		),
		createIceMessage: connect.NewClient[gen.CreateIceMessageRequest, gen.IceMessage](
			httpClient,
			baseURL+SignalerServiceCreateIceMessageProcedure,
			opts...,
		),
		popIceMessage: connect.NewClient[gen.PopIceMessageRequest, gen.IceMessage](
			httpClient,
			baseURL+SignalerServicePopIceMessageProcedure,
			opts...,
		),
		createSample: connect.NewClient[gen.CreateSampleRequest, gen.Sample](
			httpClient,
			baseURL+SignalerServiceCreateSampleProcedure,
			opts...,
		),
		listSamples: connect.NewClient[gen.ListSamplesRequest, gen.ListSamplesResponse](
			httpClient,
			baseURL+SignalerServiceListSamplesProcedure,
			opts...,
		),
	}
}

// signalerServiceClient implements SignalerServiceClient.
type signalerServiceClient struct {
	createAuthToken  *connect.Client[gen.CreateAuthTokenRequest, gen.AuthToken]
	listCameras      *connect.Client[gen.ListCamerasRequest, gen.ListCamerasResponse]
	createSession    *connect.Client[gen.CreateSessionRequest, gen.Session]
	popSession       *connect.Client[gen.PopSessionRequest, gen.Session]
	createIceMessage *connect.Client[gen.CreateIceMessageRequest, gen.IceMessage]
	popIceMessage    *connect.Client[gen.PopIceMessageRequest, gen.IceMessage]
	createSample     *connect.Client[gen.CreateSampleRequest, gen.Sample]
	listSamples      *connect.Client[gen.ListSamplesRequest, gen.ListSamplesResponse]
}

// CreateAuthToken calls signaler.SignalerService.CreateAuthToken.
func (c *signalerServiceClient) CreateAuthToken(ctx context.Context, req *connect.Request[gen.CreateAuthTokenRequest]) (*connect.Response[gen.AuthToken], error) {
	return c.createAuthToken.CallUnary(ctx, req)
}

// ListCameras calls signaler.SignalerService.ListCameras.
func (c *signalerServiceClient) ListCameras(ctx context.Context, req *connect.Request[gen.ListCamerasRequest]) (*connect.Response[gen.ListCamerasResponse], error) {
	return c.listCameras.CallUnary(ctx, req)
}

// CreateSession calls signaler.SignalerService.CreateSession.
func (c *signalerServiceClient) CreateSession(ctx context.Context, req *connect.Request[gen.CreateSessionRequest]) (*connect.Response[gen.Session], error) {
	return c.createSession.CallUnary(ctx, req)
}

// PopSession calls signaler.SignalerService.PopSession.
func (c *signalerServiceClient) PopSession(ctx context.Context, req *connect.Request[gen.PopSessionRequest]) (*connect.Response[gen.Session], error) {
	return c.popSession.CallUnary(ctx, req)
}

// CreateIceMessage calls signaler.SignalerService.CreateIceMessage.
func (c *signalerServiceClient) CreateIceMessage(ctx context.Context, req *connect.Request[gen.CreateIceMessageRequest]) (*connect.Response[gen.IceMessage], error) {
	return c.createIceMessage.CallUnary(ctx, req)
}

// PopIceMessage calls signaler.SignalerService.PopIceMessage.
func (c *signalerServiceClient) PopIceMessage(ctx context.Context, req *connect.Request[gen.PopIceMessageRequest]) (*connect.Response[gen.IceMessage], error) {
	return c.popIceMessage.CallUnary(ctx, req)
}

// CreateSample calls signaler.SignalerService.CreateSample.
func (c *signalerServiceClient) CreateSample(ctx context.Context, req *connect.Request[gen.CreateSampleRequest]) (*connect.Response[gen.Sample], error) {
	return c.createSample.CallUnary(ctx, req)
}

// ListSamples calls signaler.SignalerService.ListSamples.
func (c *signalerServiceClient) ListSamples(ctx context.Context, req *connect.Request[gen.ListSamplesRequest]) (*connect.Response[gen.ListSamplesResponse], error) {
	return c.listSamples.CallUnary(ctx, req)
}

// SignalerServiceHandler is an implementation of the signaler.SignalerService service.
type SignalerServiceHandler interface {
	CreateAuthToken(context.Context, *connect.Request[gen.CreateAuthTokenRequest]) (*connect.Response[gen.AuthToken], error)
	ListCameras(context.Context, *connect.Request[gen.ListCamerasRequest]) (*connect.Response[gen.ListCamerasResponse], error)
	// CreateSession creates a new session that can be seen bv the provided Camera and Peer.
	//
	// Optionally, wait_for_update can be set to prevent returning until the Camera has seen the
	// session request, populated candidates, and returned a session offer.
	CreateSession(context.Context, *connect.Request[gen.CreateSessionRequest]) (*connect.Response[gen.Session], error)
	// PopSession deletes a session from the list of sessions, and returns it.
	//
	// If there are no sessions, this blocks until one becomes available.
	PopSession(context.Context, *connect.Request[gen.PopSessionRequest]) (*connect.Response[gen.Session], error)
	// CreateIceMessage adds the provided message to the list of candidates.
	CreateIceMessage(context.Context, *connect.Request[gen.CreateIceMessageRequest]) (*connect.Response[gen.IceMessage], error)
	// PopIceCandidate delete a message from the list of messages and returns it.
	//
	// If there are no messages, this blocks until one becomes available.
	PopIceMessage(context.Context, *connect.Request[gen.PopIceMessageRequest]) (*connect.Response[gen.IceMessage], error)
	// CreateSample creates a sample for the given camera.
	// If called without an auth token indicating a camera, an error
	// is returned.
	// TODO: this should be moved to a seperate service
	CreateSample(context.Context, *connect.Request[gen.CreateSampleRequest]) (*connect.Response[gen.Sample], error)
	ListSamples(context.Context, *connect.Request[gen.ListSamplesRequest]) (*connect.Response[gen.ListSamplesResponse], error)
}

// NewSignalerServiceHandler 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 NewSignalerServiceHandler(svc SignalerServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	signalerServiceCreateAuthTokenHandler := connect.NewUnaryHandler(
		SignalerServiceCreateAuthTokenProcedure,
		svc.CreateAuthToken,
		opts...,
	)
	signalerServiceListCamerasHandler := connect.NewUnaryHandler(
		SignalerServiceListCamerasProcedure,
		svc.ListCameras,
		opts...,
	)
	signalerServiceCreateSessionHandler := connect.NewUnaryHandler(
		SignalerServiceCreateSessionProcedure,
		svc.CreateSession,
		opts...,
	)
	signalerServicePopSessionHandler := connect.NewUnaryHandler(
		SignalerServicePopSessionProcedure,
		svc.PopSession,
		opts...,
	)
	signalerServiceCreateIceMessageHandler := connect.NewUnaryHandler(
		SignalerServiceCreateIceMessageProcedure,
		svc.CreateIceMessage,
		opts...,
	)
	signalerServicePopIceMessageHandler := connect.NewUnaryHandler(
		SignalerServicePopIceMessageProcedure,
		svc.PopIceMessage,
		opts...,
	)
	signalerServiceCreateSampleHandler := connect.NewUnaryHandler(
		SignalerServiceCreateSampleProcedure,
		svc.CreateSample,
		opts...,
	)
	signalerServiceListSamplesHandler := connect.NewUnaryHandler(
		SignalerServiceListSamplesProcedure,
		svc.ListSamples,
		opts...,
	)
	return "/signaler.SignalerService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case SignalerServiceCreateAuthTokenProcedure:
			signalerServiceCreateAuthTokenHandler.ServeHTTP(w, r)
		case SignalerServiceListCamerasProcedure:
			signalerServiceListCamerasHandler.ServeHTTP(w, r)
		case SignalerServiceCreateSessionProcedure:
			signalerServiceCreateSessionHandler.ServeHTTP(w, r)
		case SignalerServicePopSessionProcedure:
			signalerServicePopSessionHandler.ServeHTTP(w, r)
		case SignalerServiceCreateIceMessageProcedure:
			signalerServiceCreateIceMessageHandler.ServeHTTP(w, r)
		case SignalerServicePopIceMessageProcedure:
			signalerServicePopIceMessageHandler.ServeHTTP(w, r)
		case SignalerServiceCreateSampleProcedure:
			signalerServiceCreateSampleHandler.ServeHTTP(w, r)
		case SignalerServiceListSamplesProcedure:
			signalerServiceListSamplesHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

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

func (UnimplementedSignalerServiceHandler) CreateAuthToken(context.Context, *connect.Request[gen.CreateAuthTokenRequest]) (*connect.Response[gen.AuthToken], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.CreateAuthToken is not implemented"))
}

func (UnimplementedSignalerServiceHandler) ListCameras(context.Context, *connect.Request[gen.ListCamerasRequest]) (*connect.Response[gen.ListCamerasResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.ListCameras is not implemented"))
}

func (UnimplementedSignalerServiceHandler) CreateSession(context.Context, *connect.Request[gen.CreateSessionRequest]) (*connect.Response[gen.Session], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.CreateSession is not implemented"))
}

func (UnimplementedSignalerServiceHandler) PopSession(context.Context, *connect.Request[gen.PopSessionRequest]) (*connect.Response[gen.Session], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.PopSession is not implemented"))
}

func (UnimplementedSignalerServiceHandler) CreateIceMessage(context.Context, *connect.Request[gen.CreateIceMessageRequest]) (*connect.Response[gen.IceMessage], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.CreateIceMessage is not implemented"))
}

func (UnimplementedSignalerServiceHandler) PopIceMessage(context.Context, *connect.Request[gen.PopIceMessageRequest]) (*connect.Response[gen.IceMessage], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.PopIceMessage is not implemented"))
}

func (UnimplementedSignalerServiceHandler) CreateSample(context.Context, *connect.Request[gen.CreateSampleRequest]) (*connect.Response[gen.Sample], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.CreateSample is not implemented"))
}

func (UnimplementedSignalerServiceHandler) ListSamples(context.Context, *connect.Request[gen.ListSamplesRequest]) (*connect.Response[gen.ListSamplesResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("signaler.SignalerService.ListSamples is not implemented"))
}
