"""Shared runtime configuration for the Airbyte Ops Webapp."""

from __future__ import annotations

import os

MOCK_ONLY_ENV_VAR = "AIRBYTE_OPS_WEBAPP_MOCKONLY"
AIRBYTE_BEARER_TOKEN_ENV_VAR = "AIRBYTE_CLOUD_BEARER_TOKEN"
AIRBYTE_CLIENT_ID_ENV_VAR = "AIRBYTE_CLOUD_CLIENT_ID"
AIRBYTE_CLIENT_SECRET_ENV_VAR = "AIRBYTE_CLOUD_CLIENT_SECRET"
AIRBYTE_CONFIG_API_ROOT_ENV_VAR = "AIRBYTE_CLOUD_CONFIG_API_URL"
OAUTH_CLIENT_ID_ENV_VAR = "AIRBYTE_OPS_WEBAPP_OAUTH_CLIENT_ID"
OAUTH_CLIENT_SECRET_ENV_VAR = "AIRBYTE_OPS_WEBAPP_OAUTH_CLIENT_SECRET"
OAUTH_ENABLED_ENV_VAR = "AIRBYTE_OPS_WEBAPP_OAUTH_ENABLED"
OAUTH_ISSUER_ENV_VAR = "AIRBYTE_OPS_WEBAPP_OAUTH_ISSUER"
OAUTH_PUBLIC_URL_ENV_VAR = "AIRBYTE_OPS_WEBAPP_PUBLIC_URL"
OAUTH_REDIRECT_URI_ENV_VAR = "AIRBYTE_OPS_WEBAPP_OAUTH_REDIRECT_URI"


def mock_only_enabled() -> bool:
    """Return `True` when the app is explicitly running with mock data."""
    return os.getenv(MOCK_ONLY_ENV_VAR, "").strip().lower() in {"1", "true"}
