import os

USER_TABLE: str = os.getenv('USER_TABLE')  # type: ignore
ORDER_TABLE: str = os.getenv('ORDER_TABLE')  # type: ignore
ENROLLMENT_TABLE: str = os.getenv('ENROLLMENT_TABLE')  # type: ignore
COURSE_TABLE: str = os.getenv('COURSE_TABLE')  # type: ignore

KONVIVA_API_URL: str = os.getenv('KONVIVA_API_URL')  # type: ignore
KONVIVA_SECRET_KEY: str = os.getenv('KONVIVA_SECRET_KEY')  # type: ignore

match os.getenv('AWS_SAM_LOCAL'), os.getenv('ELASTIC_HOSTS'):
    case str() as AWS_SAM_LOCAL, _ if (
        AWS_SAM_LOCAL
    ):  # Only when running `sam local start-api`
        ELASTIC_CONN = {
            'hosts': 'http://host.docker.internal:9200',
        }
    case _, str() as ELASTIC_HOSTS if ELASTIC_HOSTS:
        ELASTIC_CONN = {
            'hosts': ELASTIC_HOSTS,
        }
    case _:
        ELASTIC_CLOUD_ID = os.getenv('ELASTIC_CLOUD_ID')
        ELASTIC_AUTH_PASS = os.getenv('ELASTIC_AUTH_PASS')
        ELASTIC_CONN = {
            'cloud_id': ELASTIC_CLOUD_ID,
            'basic_auth': ('elastic', ELASTIC_AUTH_PASS),
        }
