// Code generated by protoc-gen-connect-go. DO NOT EDIT.
//
// Source: tars/insights/v1/request_logs.proto

package insightsv1connect

import (
	connect "connectrpc.com/connect"
	context "context"
	errors "errors"
	v1 "github.com/tetrateio/agentrouter-go/genapi/api/tars/insights/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 (
	// CustomerRequestLogsServiceName is the fully-qualified name of the CustomerRequestLogsService
	// service.
	CustomerRequestLogsServiceName = "tars.insights.v1.CustomerRequestLogsService"
	// RequestLogsServiceName is the fully-qualified name of the RequestLogsService service.
	RequestLogsServiceName = "tars.insights.v1.RequestLogsService"
)

// 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 (
	// CustomerRequestLogsServiceListCustomerRequestLogsProcedure is the fully-qualified name of the
	// CustomerRequestLogsService's ListCustomerRequestLogs RPC.
	CustomerRequestLogsServiceListCustomerRequestLogsProcedure = "/tars.insights.v1.CustomerRequestLogsService/ListCustomerRequestLogs"
	// CustomerRequestLogsServiceGetCustomerRequestLogProcedure is the fully-qualified name of the
	// CustomerRequestLogsService's GetCustomerRequestLog RPC.
	CustomerRequestLogsServiceGetCustomerRequestLogProcedure = "/tars.insights.v1.CustomerRequestLogsService/GetCustomerRequestLog"
	// CustomerRequestLogsServiceGetCustomerRequestLogStatsProcedure is the fully-qualified name of the
	// CustomerRequestLogsService's GetCustomerRequestLogStats RPC.
	CustomerRequestLogsServiceGetCustomerRequestLogStatsProcedure = "/tars.insights.v1.CustomerRequestLogsService/GetCustomerRequestLogStats"
	// RequestLogsServiceQueryRequestLogsProcedure is the fully-qualified name of the
	// RequestLogsService's QueryRequestLogs RPC.
	RequestLogsServiceQueryRequestLogsProcedure = "/tars.insights.v1.RequestLogsService/QueryRequestLogs"
	// RequestLogsServiceGetRequestLogProcedure is the fully-qualified name of the RequestLogsService's
	// GetRequestLog RPC.
	RequestLogsServiceGetRequestLogProcedure = "/tars.insights.v1.RequestLogsService/GetRequestLog"
	// RequestLogsServiceGetRequestLogStatsProcedure is the fully-qualified name of the
	// RequestLogsService's GetRequestLogStats RPC.
	RequestLogsServiceGetRequestLogStatsProcedure = "/tars.insights.v1.RequestLogsService/GetRequestLogStats"
)

// CustomerRequestLogsServiceClient is a client for the tars.insights.v1.CustomerRequestLogsService
// service.
type CustomerRequestLogsServiceClient interface {
	// ListCustomerRequestLogs returns the caller's own request logs,
	// filtered by the supplied tenancy scope. Forced filter:
	// `user_id = caller.UserID`.
	ListCustomerRequestLogs(context.Context, *connect.Request[v1.ListCustomerRequestLogsRequest]) (*connect.Response[v1.ListCustomerRequestLogsResponse], error)
	// GetCustomerRequestLog returns a single request log row owned by the
	// calling user. Cross-user NotFound: the user cannot read another
	// user's log even within the same customer/project.
	GetCustomerRequestLog(context.Context, *connect.Request[v1.GetCustomerRequestLogRequest]) (*connect.Response[v1.RequestLog], error)
	// GetCustomerRequestLogStats returns aggregated statistics over the
	// calling user's request logs within the supplied tenancy scope.
	GetCustomerRequestLogStats(context.Context, *connect.Request[v1.GetCustomerRequestLogStatsRequest]) (*connect.Response[v1.RequestLogStatsResponse], error)
}

// NewCustomerRequestLogsServiceClient constructs a client for the
// tars.insights.v1.CustomerRequestLogsService 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 NewCustomerRequestLogsServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) CustomerRequestLogsServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	customerRequestLogsServiceMethods := v1.File_tars_insights_v1_request_logs_proto.Services().ByName("CustomerRequestLogsService").Methods()
	return &customerRequestLogsServiceClient{
		listCustomerRequestLogs: connect.NewClient[v1.ListCustomerRequestLogsRequest, v1.ListCustomerRequestLogsResponse](
			httpClient,
			baseURL+CustomerRequestLogsServiceListCustomerRequestLogsProcedure,
			connect.WithSchema(customerRequestLogsServiceMethods.ByName("ListCustomerRequestLogs")),
			connect.WithIdempotency(connect.IdempotencyNoSideEffects),
			connect.WithClientOptions(opts...),
		),
		getCustomerRequestLog: connect.NewClient[v1.GetCustomerRequestLogRequest, v1.RequestLog](
			httpClient,
			baseURL+CustomerRequestLogsServiceGetCustomerRequestLogProcedure,
			connect.WithSchema(customerRequestLogsServiceMethods.ByName("GetCustomerRequestLog")),
			connect.WithIdempotency(connect.IdempotencyNoSideEffects),
			connect.WithClientOptions(opts...),
		),
		getCustomerRequestLogStats: connect.NewClient[v1.GetCustomerRequestLogStatsRequest, v1.RequestLogStatsResponse](
			httpClient,
			baseURL+CustomerRequestLogsServiceGetCustomerRequestLogStatsProcedure,
			connect.WithSchema(customerRequestLogsServiceMethods.ByName("GetCustomerRequestLogStats")),
			connect.WithIdempotency(connect.IdempotencyNoSideEffects),
			connect.WithClientOptions(opts...),
		),
	}
}

// customerRequestLogsServiceClient implements CustomerRequestLogsServiceClient.
type customerRequestLogsServiceClient struct {
	listCustomerRequestLogs    *connect.Client[v1.ListCustomerRequestLogsRequest, v1.ListCustomerRequestLogsResponse]
	getCustomerRequestLog      *connect.Client[v1.GetCustomerRequestLogRequest, v1.RequestLog]
	getCustomerRequestLogStats *connect.Client[v1.GetCustomerRequestLogStatsRequest, v1.RequestLogStatsResponse]
}

// ListCustomerRequestLogs calls
// tars.insights.v1.CustomerRequestLogsService.ListCustomerRequestLogs.
func (c *customerRequestLogsServiceClient) ListCustomerRequestLogs(ctx context.Context, req *connect.Request[v1.ListCustomerRequestLogsRequest]) (*connect.Response[v1.ListCustomerRequestLogsResponse], error) {
	return c.listCustomerRequestLogs.CallUnary(ctx, req)
}

// GetCustomerRequestLog calls tars.insights.v1.CustomerRequestLogsService.GetCustomerRequestLog.
func (c *customerRequestLogsServiceClient) GetCustomerRequestLog(ctx context.Context, req *connect.Request[v1.GetCustomerRequestLogRequest]) (*connect.Response[v1.RequestLog], error) {
	return c.getCustomerRequestLog.CallUnary(ctx, req)
}

// GetCustomerRequestLogStats calls
// tars.insights.v1.CustomerRequestLogsService.GetCustomerRequestLogStats.
func (c *customerRequestLogsServiceClient) GetCustomerRequestLogStats(ctx context.Context, req *connect.Request[v1.GetCustomerRequestLogStatsRequest]) (*connect.Response[v1.RequestLogStatsResponse], error) {
	return c.getCustomerRequestLogStats.CallUnary(ctx, req)
}

// CustomerRequestLogsServiceHandler is an implementation of the
// tars.insights.v1.CustomerRequestLogsService service.
type CustomerRequestLogsServiceHandler interface {
	// ListCustomerRequestLogs returns the caller's own request logs,
	// filtered by the supplied tenancy scope. Forced filter:
	// `user_id = caller.UserID`.
	ListCustomerRequestLogs(context.Context, *connect.Request[v1.ListCustomerRequestLogsRequest]) (*connect.Response[v1.ListCustomerRequestLogsResponse], error)
	// GetCustomerRequestLog returns a single request log row owned by the
	// calling user. Cross-user NotFound: the user cannot read another
	// user's log even within the same customer/project.
	GetCustomerRequestLog(context.Context, *connect.Request[v1.GetCustomerRequestLogRequest]) (*connect.Response[v1.RequestLog], error)
	// GetCustomerRequestLogStats returns aggregated statistics over the
	// calling user's request logs within the supplied tenancy scope.
	GetCustomerRequestLogStats(context.Context, *connect.Request[v1.GetCustomerRequestLogStatsRequest]) (*connect.Response[v1.RequestLogStatsResponse], error)
}

// NewCustomerRequestLogsServiceHandler 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 NewCustomerRequestLogsServiceHandler(svc CustomerRequestLogsServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	customerRequestLogsServiceMethods := v1.File_tars_insights_v1_request_logs_proto.Services().ByName("CustomerRequestLogsService").Methods()
	customerRequestLogsServiceListCustomerRequestLogsHandler := connect.NewUnaryHandler(
		CustomerRequestLogsServiceListCustomerRequestLogsProcedure,
		svc.ListCustomerRequestLogs,
		connect.WithSchema(customerRequestLogsServiceMethods.ByName("ListCustomerRequestLogs")),
		connect.WithIdempotency(connect.IdempotencyNoSideEffects),
		connect.WithHandlerOptions(opts...),
	)
	customerRequestLogsServiceGetCustomerRequestLogHandler := connect.NewUnaryHandler(
		CustomerRequestLogsServiceGetCustomerRequestLogProcedure,
		svc.GetCustomerRequestLog,
		connect.WithSchema(customerRequestLogsServiceMethods.ByName("GetCustomerRequestLog")),
		connect.WithIdempotency(connect.IdempotencyNoSideEffects),
		connect.WithHandlerOptions(opts...),
	)
	customerRequestLogsServiceGetCustomerRequestLogStatsHandler := connect.NewUnaryHandler(
		CustomerRequestLogsServiceGetCustomerRequestLogStatsProcedure,
		svc.GetCustomerRequestLogStats,
		connect.WithSchema(customerRequestLogsServiceMethods.ByName("GetCustomerRequestLogStats")),
		connect.WithIdempotency(connect.IdempotencyNoSideEffects),
		connect.WithHandlerOptions(opts...),
	)
	return "/tars.insights.v1.CustomerRequestLogsService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case CustomerRequestLogsServiceListCustomerRequestLogsProcedure:
			customerRequestLogsServiceListCustomerRequestLogsHandler.ServeHTTP(w, r)
		case CustomerRequestLogsServiceGetCustomerRequestLogProcedure:
			customerRequestLogsServiceGetCustomerRequestLogHandler.ServeHTTP(w, r)
		case CustomerRequestLogsServiceGetCustomerRequestLogStatsProcedure:
			customerRequestLogsServiceGetCustomerRequestLogStatsHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

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

func (UnimplementedCustomerRequestLogsServiceHandler) ListCustomerRequestLogs(context.Context, *connect.Request[v1.ListCustomerRequestLogsRequest]) (*connect.Response[v1.ListCustomerRequestLogsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("tars.insights.v1.CustomerRequestLogsService.ListCustomerRequestLogs is not implemented"))
}

func (UnimplementedCustomerRequestLogsServiceHandler) GetCustomerRequestLog(context.Context, *connect.Request[v1.GetCustomerRequestLogRequest]) (*connect.Response[v1.RequestLog], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("tars.insights.v1.CustomerRequestLogsService.GetCustomerRequestLog is not implemented"))
}

func (UnimplementedCustomerRequestLogsServiceHandler) GetCustomerRequestLogStats(context.Context, *connect.Request[v1.GetCustomerRequestLogStatsRequest]) (*connect.Response[v1.RequestLogStatsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("tars.insights.v1.CustomerRequestLogsService.GetCustomerRequestLogStats is not implemented"))
}

// RequestLogsServiceClient is a client for the tars.insights.v1.RequestLogsService service.
type RequestLogsServiceClient interface {
	// QueryRequestLogs retrieves request logs with filtering and pagination.
	QueryRequestLogs(context.Context, *connect.Request[v1.QueryRequestLogsRequest]) (*connect.Response[v1.QueryRequestLogsResponse], error)
	// GetRequestLog retrieves a single request log by request ID.
	GetRequestLog(context.Context, *connect.Request[v1.GetRequestLogRequest]) (*connect.Response[v1.RequestLog], error)
	// GetRequestLogStats returns aggregated statistics for request logs.
	GetRequestLogStats(context.Context, *connect.Request[v1.GetRequestLogStatsRequest]) (*connect.Response[v1.RequestLogStatsResponse], error)
}

// NewRequestLogsServiceClient constructs a client for the tars.insights.v1.RequestLogsService
// 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 NewRequestLogsServiceClient(httpClient connect.HTTPClient, baseURL string, opts ...connect.ClientOption) RequestLogsServiceClient {
	baseURL = strings.TrimRight(baseURL, "/")
	requestLogsServiceMethods := v1.File_tars_insights_v1_request_logs_proto.Services().ByName("RequestLogsService").Methods()
	return &requestLogsServiceClient{
		queryRequestLogs: connect.NewClient[v1.QueryRequestLogsRequest, v1.QueryRequestLogsResponse](
			httpClient,
			baseURL+RequestLogsServiceQueryRequestLogsProcedure,
			connect.WithSchema(requestLogsServiceMethods.ByName("QueryRequestLogs")),
			connect.WithIdempotency(connect.IdempotencyNoSideEffects),
			connect.WithClientOptions(opts...),
		),
		getRequestLog: connect.NewClient[v1.GetRequestLogRequest, v1.RequestLog](
			httpClient,
			baseURL+RequestLogsServiceGetRequestLogProcedure,
			connect.WithSchema(requestLogsServiceMethods.ByName("GetRequestLog")),
			connect.WithIdempotency(connect.IdempotencyNoSideEffects),
			connect.WithClientOptions(opts...),
		),
		getRequestLogStats: connect.NewClient[v1.GetRequestLogStatsRequest, v1.RequestLogStatsResponse](
			httpClient,
			baseURL+RequestLogsServiceGetRequestLogStatsProcedure,
			connect.WithSchema(requestLogsServiceMethods.ByName("GetRequestLogStats")),
			connect.WithIdempotency(connect.IdempotencyNoSideEffects),
			connect.WithClientOptions(opts...),
		),
	}
}

// requestLogsServiceClient implements RequestLogsServiceClient.
type requestLogsServiceClient struct {
	queryRequestLogs   *connect.Client[v1.QueryRequestLogsRequest, v1.QueryRequestLogsResponse]
	getRequestLog      *connect.Client[v1.GetRequestLogRequest, v1.RequestLog]
	getRequestLogStats *connect.Client[v1.GetRequestLogStatsRequest, v1.RequestLogStatsResponse]
}

// QueryRequestLogs calls tars.insights.v1.RequestLogsService.QueryRequestLogs.
func (c *requestLogsServiceClient) QueryRequestLogs(ctx context.Context, req *connect.Request[v1.QueryRequestLogsRequest]) (*connect.Response[v1.QueryRequestLogsResponse], error) {
	return c.queryRequestLogs.CallUnary(ctx, req)
}

// GetRequestLog calls tars.insights.v1.RequestLogsService.GetRequestLog.
func (c *requestLogsServiceClient) GetRequestLog(ctx context.Context, req *connect.Request[v1.GetRequestLogRequest]) (*connect.Response[v1.RequestLog], error) {
	return c.getRequestLog.CallUnary(ctx, req)
}

// GetRequestLogStats calls tars.insights.v1.RequestLogsService.GetRequestLogStats.
func (c *requestLogsServiceClient) GetRequestLogStats(ctx context.Context, req *connect.Request[v1.GetRequestLogStatsRequest]) (*connect.Response[v1.RequestLogStatsResponse], error) {
	return c.getRequestLogStats.CallUnary(ctx, req)
}

// RequestLogsServiceHandler is an implementation of the tars.insights.v1.RequestLogsService
// service.
type RequestLogsServiceHandler interface {
	// QueryRequestLogs retrieves request logs with filtering and pagination.
	QueryRequestLogs(context.Context, *connect.Request[v1.QueryRequestLogsRequest]) (*connect.Response[v1.QueryRequestLogsResponse], error)
	// GetRequestLog retrieves a single request log by request ID.
	GetRequestLog(context.Context, *connect.Request[v1.GetRequestLogRequest]) (*connect.Response[v1.RequestLog], error)
	// GetRequestLogStats returns aggregated statistics for request logs.
	GetRequestLogStats(context.Context, *connect.Request[v1.GetRequestLogStatsRequest]) (*connect.Response[v1.RequestLogStatsResponse], error)
}

// NewRequestLogsServiceHandler 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 NewRequestLogsServiceHandler(svc RequestLogsServiceHandler, opts ...connect.HandlerOption) (string, http.Handler) {
	requestLogsServiceMethods := v1.File_tars_insights_v1_request_logs_proto.Services().ByName("RequestLogsService").Methods()
	requestLogsServiceQueryRequestLogsHandler := connect.NewUnaryHandler(
		RequestLogsServiceQueryRequestLogsProcedure,
		svc.QueryRequestLogs,
		connect.WithSchema(requestLogsServiceMethods.ByName("QueryRequestLogs")),
		connect.WithIdempotency(connect.IdempotencyNoSideEffects),
		connect.WithHandlerOptions(opts...),
	)
	requestLogsServiceGetRequestLogHandler := connect.NewUnaryHandler(
		RequestLogsServiceGetRequestLogProcedure,
		svc.GetRequestLog,
		connect.WithSchema(requestLogsServiceMethods.ByName("GetRequestLog")),
		connect.WithIdempotency(connect.IdempotencyNoSideEffects),
		connect.WithHandlerOptions(opts...),
	)
	requestLogsServiceGetRequestLogStatsHandler := connect.NewUnaryHandler(
		RequestLogsServiceGetRequestLogStatsProcedure,
		svc.GetRequestLogStats,
		connect.WithSchema(requestLogsServiceMethods.ByName("GetRequestLogStats")),
		connect.WithIdempotency(connect.IdempotencyNoSideEffects),
		connect.WithHandlerOptions(opts...),
	)
	return "/tars.insights.v1.RequestLogsService/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		switch r.URL.Path {
		case RequestLogsServiceQueryRequestLogsProcedure:
			requestLogsServiceQueryRequestLogsHandler.ServeHTTP(w, r)
		case RequestLogsServiceGetRequestLogProcedure:
			requestLogsServiceGetRequestLogHandler.ServeHTTP(w, r)
		case RequestLogsServiceGetRequestLogStatsProcedure:
			requestLogsServiceGetRequestLogStatsHandler.ServeHTTP(w, r)
		default:
			http.NotFound(w, r)
		}
	})
}

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

func (UnimplementedRequestLogsServiceHandler) QueryRequestLogs(context.Context, *connect.Request[v1.QueryRequestLogsRequest]) (*connect.Response[v1.QueryRequestLogsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("tars.insights.v1.RequestLogsService.QueryRequestLogs is not implemented"))
}

func (UnimplementedRequestLogsServiceHandler) GetRequestLog(context.Context, *connect.Request[v1.GetRequestLogRequest]) (*connect.Response[v1.RequestLog], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("tars.insights.v1.RequestLogsService.GetRequestLog is not implemented"))
}

func (UnimplementedRequestLogsServiceHandler) GetRequestLogStats(context.Context, *connect.Request[v1.GetRequestLogStatsRequest]) (*connect.Response[v1.RequestLogStatsResponse], error) {
	return nil, connect.NewError(connect.CodeUnimplemented, errors.New("tars.insights.v1.RequestLogsService.GetRequestLogStats is not implemented"))
}
