# Code generated by tools/sdkgen. DO NOT EDIT.
#
# Proto-driven ergonomic handles for the TARS services that have no hand-written
# handle in _services.py. Each method takes the request message, calls the
# Connect-JSON transport, and returns the typed response (None for
# google.protobuf.Empty responses). Regenerate with: make sdk.wrappers.generate

from __future__ import annotations

from typing import Any
from tars.admin.v1 import admin_pb2
from tars.api_keys.v1 import api_keys_pb2
from tars.auth.v1 import auth_pb2
from tars.configurator.v1 import configurator_pb2
from tars.insights.v1 import request_logs_pb2
from tars.secret.v1 import secret_pb2
from tars.tokens.v1 import tokens_pb2

from ._transport import Transport


# --- AdminService (tars.admin.v1) ---


class AdminGenHandle:
    SERVICE = "tars.admin.v1.AdminService"

    def __init__(self, t: Transport):
        self._t = t

    def ping(self, req: admin_pb2.PingRequest) -> Any:
        """Ping endpoint for health checks and authentication testing"""
        return self._t.unary(self.SERVICE, "Ping", req, admin_pb2.PingResponse)

    def create_workspace(self, req: admin_pb2.CreateWorkspaceRequest) -> Any:
        """Create workspace"""
        return self._t.unary(self.SERVICE, "CreateWorkspace", req, admin_pb2.CreateWorkspaceResponse)

    def list_workspaces(self, req: admin_pb2.ListWorkspacesRequest) -> Any:
        """List workspaces"""
        return self._t.unary(self.SERVICE, "ListWorkspaces", req, admin_pb2.ListWorkspacesResponse)

    def get_workspace(self, req: admin_pb2.GetWorkspaceRequest) -> Any:
        """Get workspace"""
        return self._t.unary(self.SERVICE, "GetWorkspace", req, admin_pb2.GetWorkspaceResponse)

    def update_workspace(self, req: admin_pb2.UpdateWorkspaceRequest) -> Any:
        """Update workspace"""
        return self._t.unary(self.SERVICE, "UpdateWorkspace", req, admin_pb2.UpdateWorkspaceResponse)

    def set_workspace_url(self, req: admin_pb2.SetWorkspaceURLRequest) -> Any:
        """Set the customer-facing gateway URL for a workspace data plane. Writes system_settings.dataplane-url:<workspace_id> and optionally fires a PROXY_URL config event."""
        return self._t.unary(self.SERVICE, "SetWorkspaceURL", req, admin_pb2.SetWorkspaceURLResponse)

    def set_workspace_project(self, req: admin_pb2.SetWorkspaceProjectRequest) -> Any:
        """Assign workspace to a project (or clear back to default project by omitting project_id)"""
        return self._t.unary(self.SERVICE, "SetWorkspaceProject", req, admin_pb2.SetWorkspaceProjectResponse)

    def delete_workspace(self, req: admin_pb2.DeleteWorkspaceRequest) -> Any:
        """Delete workspace (soft delete)"""
        return self._t.unary(self.SERVICE, "DeleteWorkspace", req, admin_pb2.DeleteWorkspaceResponse)

    def create_service_account(self, req: admin_pb2.CreateServiceAccountRequest) -> Any:
        """Create service account"""
        return self._t.unary(self.SERVICE, "CreateServiceAccount", req, admin_pb2.CreateServiceAccountResponse)

    def list_service_accounts(self, req: admin_pb2.ListServiceAccountsRequest) -> Any:
        """List service accounts"""
        return self._t.unary(self.SERVICE, "ListServiceAccounts", req, admin_pb2.ListServiceAccountsResponse)

    def get_service_account(self, req: admin_pb2.GetServiceAccountRequest) -> Any:
        """Get service account"""
        return self._t.unary(self.SERVICE, "GetServiceAccount", req, admin_pb2.GetServiceAccountResponse)

    def revoke_service_account(self, req: admin_pb2.RevokeServiceAccountRequest) -> Any:
        """Revoke service account"""
        return self._t.unary(self.SERVICE, "RevokeServiceAccount", req, admin_pb2.RevokeServiceAccountResponse)

    def restore_service_account(self, req: admin_pb2.RestoreServiceAccountRequest) -> Any:
        """Restore service account Restores a revoked service account to active status. Only one active service account per customer_id + workspace_id is allowed."""
        return self._t.unary(self.SERVICE, "RestoreServiceAccount", req, admin_pb2.RestoreServiceAccountResponse)

    def create_user_token(self, req: admin_pb2.CreateUserTokenRequest) -> Any:
        """Create user token Generates a JWT token for user authentication with gatekeeper."""
        return self._t.unary(self.SERVICE, "CreateUserToken", req, admin_pb2.CreateUserTokenResponse)

    def list_user_tokens(self, req: admin_pb2.ListUserTokensRequest) -> Any:
        """List user tokens"""
        return self._t.unary(self.SERVICE, "ListUserTokens", req, admin_pb2.ListUserTokensResponse)

    def get_user_token(self, req: admin_pb2.GetUserTokenRequest) -> Any:
        """Get user token"""
        return self._t.unary(self.SERVICE, "GetUserToken", req, admin_pb2.GetUserTokenResponse)

    def revoke_user_token(self, req: admin_pb2.RevokeUserTokenRequest) -> Any:
        """Revoke user token Revokes a user token by its JTI (JWT ID)."""
        return self._t.unary(self.SERVICE, "RevokeUserToken", req, admin_pb2.RevokeUserTokenResponse)

    def create_telemetry_config(self, req: admin_pb2.CreateTelemetryConfigRequest) -> Any:
        """Create telemetry config"""
        return self._t.unary(self.SERVICE, "CreateTelemetryConfig", req, admin_pb2.CreateTelemetryConfigResponse)

    def list_telemetry_configs(self, req: admin_pb2.ListTelemetryConfigsRequest) -> Any:
        """List telemetry configs"""
        return self._t.unary(self.SERVICE, "ListTelemetryConfigs", req, admin_pb2.ListTelemetryConfigsResponse)

    def get_telemetry_config(self, req: admin_pb2.GetTelemetryConfigRequest) -> Any:
        """Get telemetry config"""
        return self._t.unary(self.SERVICE, "GetTelemetryConfig", req, admin_pb2.GetTelemetryConfigResponse)

    def update_telemetry_config(self, req: admin_pb2.UpdateTelemetryConfigRequest) -> Any:
        """Update telemetry config"""
        return self._t.unary(self.SERVICE, "UpdateTelemetryConfig", req, admin_pb2.UpdateTelemetryConfigResponse)

    def delete_telemetry_config(self, req: admin_pb2.DeleteTelemetryConfigRequest) -> Any:
        """Delete telemetry config"""
        return self._t.unary(self.SERVICE, "DeleteTelemetryConfig", req, admin_pb2.DeleteTelemetryConfigResponse)

    def create_customer(self, req: admin_pb2.CreateCustomerRequest) -> Any:
        return self._t.unary(self.SERVICE, "CreateCustomer", req, admin_pb2.CreateCustomerResponse)

    def list_customers(self, req: admin_pb2.ListCustomersRequest) -> Any:
        return self._t.unary(self.SERVICE, "ListCustomers", req, admin_pb2.ListCustomersResponse)

    def get_customer(self, req: admin_pb2.GetCustomerRequest) -> Any:
        return self._t.unary(self.SERVICE, "GetCustomer", req, admin_pb2.GetCustomerResponse)

    def update_customer(self, req: admin_pb2.UpdateCustomerRequest) -> Any:
        return self._t.unary(self.SERVICE, "UpdateCustomer", req, admin_pb2.UpdateCustomerResponse)

    def delete_customer(self, req: admin_pb2.DeleteCustomerRequest) -> Any:
        return self._t.unary(self.SERVICE, "DeleteCustomer", req, admin_pb2.DeleteCustomerResponse)

    def create_project(self, req: admin_pb2.CreateProjectRequest) -> Any:
        return self._t.unary(self.SERVICE, "CreateProject", req, admin_pb2.CreateProjectResponse)

    def list_projects(self, req: admin_pb2.ListProjectsRequest) -> Any:
        return self._t.unary(self.SERVICE, "ListProjects", req, admin_pb2.ListProjectsResponse)

    def get_project(self, req: admin_pb2.GetProjectRequest) -> Any:
        return self._t.unary(self.SERVICE, "GetProject", req, admin_pb2.GetProjectResponse)

    def update_project(self, req: admin_pb2.UpdateProjectRequest) -> Any:
        return self._t.unary(self.SERVICE, "UpdateProject", req, admin_pb2.UpdateProjectResponse)

    def delete_project(self, req: admin_pb2.DeleteProjectRequest) -> Any:
        return self._t.unary(self.SERVICE, "DeleteProject", req, admin_pb2.DeleteProjectResponse)

    def add_project_member(self, req: admin_pb2.AddProjectMemberRequest) -> Any:
        return self._t.unary(self.SERVICE, "AddProjectMember", req, admin_pb2.AddProjectMemberResponse)

    def list_project_members(self, req: admin_pb2.ListProjectMembersRequest) -> Any:
        return self._t.unary(self.SERVICE, "ListProjectMembers", req, admin_pb2.ListProjectMembersResponse)

    def update_project_member(self, req: admin_pb2.UpdateProjectMemberRequest) -> Any:
        return self._t.unary(self.SERVICE, "UpdateProjectMember", req, admin_pb2.UpdateProjectMemberResponse)

    def remove_project_member(self, req: admin_pb2.RemoveProjectMemberRequest) -> Any:
        return self._t.unary(self.SERVICE, "RemoveProjectMember", req, admin_pb2.RemoveProjectMemberResponse)

    def list_models(self, req: admin_pb2.ListModelsRequest) -> Any:
        return self._t.unary(self.SERVICE, "ListModels", req, admin_pb2.ListModelsResponse)

    def get_model(self, req: admin_pb2.GetModelRequest) -> Any:
        return self._t.unary(self.SERVICE, "GetModel", req, admin_pb2.GetModelResponse)

    def add_project_model(self, req: admin_pb2.AddProjectModelRequest) -> Any:
        return self._t.unary(self.SERVICE, "AddProjectModel", req, admin_pb2.AddProjectModelResponse)

    def list_project_models(self, req: admin_pb2.ListProjectModelsRequest) -> Any:
        return self._t.unary(self.SERVICE, "ListProjectModels", req, admin_pb2.ListProjectModelsResponse)

    def remove_project_model(self, req: admin_pb2.RemoveProjectModelRequest) -> Any:
        return self._t.unary(self.SERVICE, "RemoveProjectModel", req, admin_pb2.RemoveProjectModelResponse)

    def add_project_provider(self, req: admin_pb2.AddProjectProviderRequest) -> Any:
        return self._t.unary(self.SERVICE, "AddProjectProvider", req, admin_pb2.AddProjectProviderResponse)

    def list_project_providers(self, req: admin_pb2.ListProjectProvidersRequest) -> Any:
        return self._t.unary(self.SERVICE, "ListProjectProviders", req, admin_pb2.ListProjectProvidersResponse)

    def remove_project_provider(self, req: admin_pb2.RemoveProjectProviderRequest) -> Any:
        return self._t.unary(self.SERVICE, "RemoveProjectProvider", req, admin_pb2.RemoveProjectProviderResponse)

    def get_project_settings(self, req: admin_pb2.GetProjectSettingsRequest) -> Any:
        return self._t.unary(self.SERVICE, "GetProjectSettings", req, admin_pb2.GetProjectSettingsResponse)

    def upsert_project_setting(self, req: admin_pb2.UpsertProjectSettingRequest) -> Any:
        return self._t.unary(self.SERVICE, "UpsertProjectSetting", req, admin_pb2.UpsertProjectSettingResponse)

    def delete_project_setting(self, req: admin_pb2.DeleteProjectSettingRequest) -> Any:
        return self._t.unary(self.SERVICE, "DeleteProjectSetting", req, admin_pb2.DeleteProjectSettingResponse)

# --- ConfiguratorService (tars.configurator.v1) ---


class ConfiguratorGenHandle:
    SERVICE = "tars.configurator.v1.ConfiguratorService"

    def __init__(self, t: Transport):
        self._t = t

    def get_configuration(self, req: configurator_pb2.GetConfigurationRequest) -> Any:
        """GetConfiguration retrieves the latest configuration for a user. Returns configuration only if the version is newer than the provided version. Supports batch queries for multiple users for efficiency."""
        return self._t.unary(self.SERVICE, "GetConfiguration", req, configurator_pb2.GetConfigurationResponse)

    def trigger_update(self, req: configurator_pb2.TriggerUpdateRequest) -> Any:
        """TriggerUpdate triggers a configuration update for a specific user and config type. This is called by the dashboard when configuration changes."""
        return self._t.unary(self.SERVICE, "TriggerUpdate", req, configurator_pb2.TriggerUpdateResponse)

    def list_configurations(self, req: configurator_pb2.ListConfigurationsRequest) -> Any:
        """ListConfigurations lists all configurations with optional filtering. Used for debugging and monitoring."""
        return self._t.unary(self.SERVICE, "ListConfigurations", req, configurator_pb2.ListConfigurationsResponse)

    def list_pending_events(self, req: configurator_pb2.ListPendingEventsRequest) -> Any:
        """ListPendingEvents returns configuration events that need processing. Used by workers to discover which configurations have updates."""
        return self._t.unary(self.SERVICE, "ListPendingEvents", req, configurator_pb2.ListPendingEventsResponse)

    def reconcile_workspace(self, req: configurator_pb2.ReconcileWorkspaceRequest) -> Any:
        """ReconcileWorkspace re-enqueues missing or stale slot events for the caller's workspace by cloning the latest sibling event of each slot the workspace has not yet converged on. Used by the worker's periodic drift sweep. Workspace is resolved from the caller's auth claims; callers without a workspace claim are rejected."""
        return self._t.unary(self.SERVICE, "ReconcileWorkspace", req, configurator_pb2.ReconcileWorkspaceResponse)

    def full_sync_workspace(self, req: configurator_pb2.FullSyncWorkspaceRequest) -> Any:
        """FullSyncWorkspace is the heavier "last resort" replay path: walks `liaison_configurations` directly rather than sibling events, so it can recover legacy unscoped events the drift sweep can't see. Worker calls this once on startup and every Nth drift sweep tick. Workspace and customer are resolved from the caller's auth claims."""
        return self._t.unary(self.SERVICE, "FullSyncWorkspace", req, configurator_pb2.FullSyncWorkspaceResponse)

    def acknowledge_event(self, req: configurator_pb2.AcknowledgeEventRequest) -> Any:
        """AcknowledgeEvent marks an event as acknowledged by a worker. This prevents other workers from processing the same event."""
        return self._t.unary(self.SERVICE, "AcknowledgeEvent", req, configurator_pb2.AcknowledgeEventResponse)

    def set_dataplane_url(self, req: configurator_pb2.SetDataplaneURLRequest) -> Any:
        """SetDataplaneURL persists the customer-facing gateway URL for a data plane (workspace). Called by `tare install` to register the URL at install time and by the management-plane dashboard when an admin edits it later. trigger_update=false (install path) only writes the system_settings row. trigger_update=true (admin-edit path) additionally fires a PROXY_URL configuration event so the running data plane converges on the new URL via the worker's existing event-handling loop."""
        return self._t.unary(self.SERVICE, "SetDataplaneURL", req, configurator_pb2.SetDataplaneURLResponse)

    def upsert_mcp_catalog_server(self, req: configurator_pb2.UpsertMCPCatalogServerRequest) -> Any:
        """UpsertMCPCatalogServer wires a deployed in-cluster MCP server into the customer's catalog. Used by `tare mcp enable <server>`: the CLI looks up the server's seed entry in mcp-catalog-tare-mcp-with-tools.json, asks the operator for the in-cluster URL, and submits this RPC to set is_enabled=true on the corresponding mcp_catalog_servers row. Default behaviour (force_overwrite=false): if the row exists, only url + is_enabled (+updated_at) are updated; dashboard-set fields (description / icon / categories / tools / etc.) are preserved. If the row is new, the seed-provided fields are used to populate it. force_overwrite=true: every seed field is written, clobbering any dashboard edits. Use sparingly — intended for "reset this row to seed defaults" repairs."""
        return self._t.unary(self.SERVICE, "UpsertMCPCatalogServer", req, configurator_pb2.UpsertMCPCatalogServerResponse)

    def validate_dataplane(self, req: configurator_pb2.ValidateDataplaneRequest) -> Any:
        """ValidateDataplane lets a data plane's filter confirm that this DP is still a valid (non-revoked) member of the customer and fetch the customer's current gatekeeper public keys. Authentication is via the caller's service-account JWT signed with its DP keypair (kid=`instance-<...>`). When the DP keypair has been soft-deleted at MP, the auth layer rejects the call with Unauthenticated — the filter treats that as "revoked" without needing a separate response field. On success, the response carries the customer's gatekeeper public keys so the filter can repopulate its in-memory cache (and the worker can repopulate `tars-config[gatekeeper-public-keys]`)."""
        return self._t.unary(self.SERVICE, "ValidateDataplane", req, configurator_pb2.ValidateDataplaneResponse)

    def complete_event(self, req: configurator_pb2.CompleteEventRequest) -> Any:
        """CompleteEvent marks an event as successfully applied or failed."""
        return self._t.unary(self.SERVICE, "CompleteEvent", req, configurator_pb2.CompleteEventResponse)

    def list_active_users(self, req: configurator_pb2.ListActiveUsersRequest) -> Any:
        """ListActiveUsers returns a list of user IDs that have active configurations. Used for monitoring and debugging."""
        return self._t.unary(self.SERVICE, "ListActiveUsers", req, configurator_pb2.ListActiveUsersResponse)

    def list_active_providers(self, req: configurator_pb2.ListActiveProvidersRequest) -> Any:
        """ListActiveProviders returns a list of active (enabled) AI providers. Used for monitoring, debugging, and querying available provider configurations."""
        return self._t.unary(self.SERVICE, "ListActiveProviders", req, configurator_pb2.ListActiveProvidersResponse)

    def save_byok_backends(self, req: configurator_pb2.SaveBYOKBackendsRequest) -> Any:
        """SaveBYOKBackends saves BYOK provider backends configuration. Used by workers to persist BYOK backend metadata to database."""
        return self._t.unary(self.SERVICE, "SaveBYOKBackends", req, configurator_pb2.SaveBYOKBackendsResponse)

    def delete_byok_backends(self, req: configurator_pb2.DeleteBYOKBackendsRequest) -> Any:
        """DeleteBYOKBackends deletes BYOK provider backends configuration. Used by workers to remove BYOK backend metadata from database."""
        return self._t.unary(self.SERVICE, "DeleteBYOKBackends", req, configurator_pb2.DeleteBYOKBackendsResponse)

    def revoke_user_token(self, req: configurator_pb2.RevokeUserTokenRequest) -> Any:
        """RevokeUserToken revokes a user token by JTI. Used by workers in enterprise mode to revoke tokens when API keys are deleted."""
        return self._t.unary(self.SERVICE, "RevokeUserToken", req, configurator_pb2.RevokeUserTokenResponse)

    def update_event_metadata(self, req: configurator_pb2.UpdateEventMetadataRequest) -> Any:
        """Replaces metadata JSON on an existing liaison_configuration_events row. Lets workers push mid-flight progress onto an event without changing its status (AcknowledgeEvent/CompleteEvent are terminal-only). Worker writes are scoped to the caller's workspace claim."""
        return self._t.unary(self.SERVICE, "UpdateEventMetadata", req, configurator_pb2.UpdateEventMetadataResponse)

    def submit_dataplane_upgrade_credentials(self, req: configurator_pb2.SubmitDataplaneUpgradeCredentialsRequest) -> Any:
        """SubmitDataplaneUpgradeCredentials stores operator-provided registry credentials for a DATAPLANE_UPGRADE event parked in NeedsCredentials. Payload is KEK-envelope encrypted at MP and stored in dataplane_upgrade_credentials. Dashboard (admin) is the only caller."""
        return self._t.unary(self.SERVICE, "SubmitDataplaneUpgradeCredentials", req, configurator_pb2.SubmitDataplaneUpgradeCredentialsResponse)

    def get_dataplane_upgrade_credentials(self, req: configurator_pb2.GetDataplaneUpgradeCredentialsRequest) -> Any:
        """GetDataplaneUpgradeCredentials returns the operator-submitted credentials for an upgrade event. MP decrypts server-side and returns plaintext over TLS — the worker (DP cluster) never has KEK access. Caller's workspace claim must match the event's workspace. Read-only — no state change until AckDataplaneUpgradeCredentials."""
        return self._t.unary(self.SERVICE, "GetDataplaneUpgradeCredentials", req, configurator_pb2.GetDataplaneUpgradeCredentialsResponse)

    def ack_dataplane_upgrade_credentials(self, req: configurator_pb2.AckDataplaneUpgradeCredentialsRequest) -> Any:
        """AckDataplaneUpgradeCredentials confirms the worker successfully materialised the credentials Secret in-cluster. MP DELETEs the ciphertext row immediately — no 30-day retention. Workspace claim must match. Idempotent: a second Ack on an already-deleted row returns success."""
        return self._t.unary(self.SERVICE, "AckDataplaneUpgradeCredentials", req, configurator_pb2.AckDataplaneUpgradeCredentialsResponse)

# --- SecretService (tars.secret.v1) ---


class SecretGenHandle:
    SERVICE = "tars.secret.v1.SecretService"

    def __init__(self, t: Transport):
        self._t = t

    def create_secret(self, req: secret_pb2.CreateSecretRequest) -> Any:
        """CreateSecret creates or updates a secret. If a secret with the same name exists, it will be updated."""
        return self._t.unary(self.SERVICE, "CreateSecret", req, secret_pb2.CreateSecretResponse)

    def get_secret(self, req: secret_pb2.GetSecretRequest) -> Any:
        """GetSecret retrieves a secret by name. Returns metadata only, not the plaintext value."""
        return self._t.unary(self.SERVICE, "GetSecret", req, secret_pb2.GetSecretResponse)

    def list_secrets(self, req: secret_pb2.ListSecretsRequest) -> Any:
        """ListSecrets lists all secrets for the authenticated user. Returns metadata only, not plaintext values."""
        return self._t.unary(self.SERVICE, "ListSecrets", req, secret_pb2.ListSecretsResponse)

    def delete_secret(self, req: secret_pb2.DeleteSecretRequest) -> Any:
        """DeleteSecret deletes a secret by name."""
        return self._t.unary(self.SERVICE, "DeleteSecret", req, secret_pb2.DeleteSecretResponse)

    def rotate_secret(self, req: secret_pb2.RotateSecretRequest) -> Any:
        """RotateSecret rotates a secret by creating a new version. The old version is marked as rotated_pending for graceful transition."""
        return self._t.unary(self.SERVICE, "RotateSecret", req, secret_pb2.RotateSecretResponse)

    def validate_secret(self, req: secret_pb2.ValidateSecretRequest) -> Any:
        """ValidateSecret validates that a secret can be decrypted. Used for health checks and troubleshooting."""
        return self._t.unary(self.SERVICE, "ValidateSecret", req, secret_pb2.ValidateSecretResponse)

    def get_secret_value(self, req: secret_pb2.GetSecretValueRequest) -> Any:
        """GetSecretValue retrieves the plaintext value of a secret. INTERNAL USE ONLY - This endpoint decrypts and returns the actual secret value. Should only be called by internal services (Liaison, Butler2, etc.)"""
        return self._t.unary(self.SERVICE, "GetSecretValue", req, secret_pb2.GetSecretValueResponse)

# --- ApiKeysService (tars.api_keys.v1) ---


class ApiKeysGenHandle:
    SERVICE = "tars.api_keys.v1.ApiKeysService"

    def __init__(self, t: Transport):
        self._t = t

    def create_api_key(self, req: api_keys_pb2.CreateApiKeyRequest) -> Any:
        """CreateApiKey creates a new JWT user-token API key for a user and returns the plaintext token exactly once."""
        return self._t.unary(self.SERVICE, "CreateApiKey", req, api_keys_pb2.CreateApiKeyResponse)

    def update_api_key(self, req: api_keys_pb2.UpdateApiKeyRequest) -> Any:
        """UpdateApiKey updates mutable fields of an API key (name and/or active state)."""
        return self._t.unary(self.SERVICE, "UpdateApiKey", req, api_keys_pb2.UpdateApiKeyResponse)

    def delete_api_key(self, req: api_keys_pb2.DeleteApiKeyRequest) -> Any:
        """DeleteApiKey soft-deletes an API key (sets deleted_at)."""
        return self._t.unary(self.SERVICE, "DeleteApiKey", req, api_keys_pb2.DeleteApiKeyResponse)

# --- CustomerRequestLogsService (tars.insights.v1) ---


class CustomerRequestLogsGenHandle:
    SERVICE = "tars.insights.v1.CustomerRequestLogsService"

    def __init__(self, t: Transport):
        self._t = t

    def list_customer_request_logs(self, req: request_logs_pb2.ListCustomerRequestLogsRequest) -> Any:
        """ListCustomerRequestLogs returns the caller's own request logs, filtered by the supplied tenancy scope. Forced filter: `user_id = caller.UserID`."""
        return self._t.unary(self.SERVICE, "ListCustomerRequestLogs", req, request_logs_pb2.ListCustomerRequestLogsResponse)

    def get_customer_request_log(self, req: request_logs_pb2.GetCustomerRequestLogRequest) -> Any:
        """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."""
        return self._t.unary(self.SERVICE, "GetCustomerRequestLog", req, request_logs_pb2.RequestLog)

    def get_customer_request_log_stats(self, req: request_logs_pb2.GetCustomerRequestLogStatsRequest) -> Any:
        """GetCustomerRequestLogStats returns aggregated statistics over the calling user's request logs within the supplied tenancy scope."""
        return self._t.unary(self.SERVICE, "GetCustomerRequestLogStats", req, request_logs_pb2.RequestLogStatsResponse)

# --- RequestLogsService (tars.insights.v1) ---


class RequestLogsGenHandle:
    SERVICE = "tars.insights.v1.RequestLogsService"

    def __init__(self, t: Transport):
        self._t = t

    def query_request_logs(self, req: request_logs_pb2.QueryRequestLogsRequest) -> Any:
        """QueryRequestLogs retrieves request logs with filtering and pagination."""
        return self._t.unary(self.SERVICE, "QueryRequestLogs", req, request_logs_pb2.QueryRequestLogsResponse)

    def get_request_log(self, req: request_logs_pb2.GetRequestLogRequest) -> Any:
        """GetRequestLog retrieves a single request log by request ID."""
        return self._t.unary(self.SERVICE, "GetRequestLog", req, request_logs_pb2.RequestLog)

    def get_request_log_stats(self, req: request_logs_pb2.GetRequestLogStatsRequest) -> Any:
        """GetRequestLogStats returns aggregated statistics for request logs."""
        return self._t.unary(self.SERVICE, "GetRequestLogStats", req, request_logs_pb2.RequestLogStatsResponse)

# --- AuthService (tars.auth.v1) ---


class AuthGenHandle:
    SERVICE = "tars.auth.v1.AuthService"

    def __init__(self, t: Transport):
        self._t = t

    def get_jwks(self, req: auth_pb2.GetJWKSRequest) -> Any:
        """JWKS endpoint. Public endpoint - no authentication required. Returns JSON Web Key Set for verifying JWT tokens."""
        return self._t.unary(self.SERVICE, "GetJWKS", req, auth_pb2.GetJWKSResponse)

# --- TokensService (tars.tokens.v1) ---


class TokensGenHandle:
    SERVICE = "tars.tokens.v1.TokensService"

    def __init__(self, t: Transport):
        self._t = t

    def get_revocation_list(self, req: tokens_pb2.GetRevocationListRequest) -> Any:
        """GetRevocationList returns a list of revoked token JTIs. This is used by dataplane to cache and check token revocations locally."""
        return self._t.unary(self.SERVICE, "GetRevocationList", req, tokens_pb2.GetRevocationListResponse)

    def update_last_used(self, req: tokens_pb2.UpdateLastUsedRequest) -> Any:
        """UpdateLastUsed updates the last used timestamp for a token. Called by dataplane when a token is used for authentication."""
        return self._t.unary(self.SERVICE, "UpdateLastUsed", req, tokens_pb2.UpdateLastUsedResponse)
