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
NEW_ENROLLMENT_TABLE: str = os.getenv('NEW_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

MEILISEARCH_HOST: str = os.getenv('MEILISEARCH_HOST')  # type: ignore
MEILISEARCH_API_KEY: str = os.getenv('MEILISEARCH_API_KEY')  # type: ignore


match os.getenv('AWS_SAM_LOCAL'), os.getenv('PYTEST_VERSION'):
    case str() as SAM_LOCAL, _ if SAM_LOCAL:  # Only when running `sam local start-api`
        MEILISEARCH_HOST = 'http://host.docker.internal:7700'
        ELASTIC_CONN = {
            'hosts': 'http://host.docker.internal:9200',
        }
    case _, str() as PYTEST if PYTEST:  # Only when running `pytest`
        MEILISEARCH_HOST = 'http://127.0.0.1:7700'
        ELASTIC_CONN = {
            'hosts': 'http://127.0.0.1:9200',
        }
    case _:
        MEILISEARCH_HOST: str = os.getenv('MEILISEARCH_HOST')  # type: ignore

        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),
        }

USER_POOOL_ID = 'sa-east-1_s6YmVSfXj'
