import os

# Detect if running inside Docker container to switch hosts/ports
RUNNING_IN_DOCKER = os.environ.get("RUNNING_IN_DOCKER") == "true"

# Database Connection Settings
if RUNNING_IN_DOCKER:
    SOURCE_MYSQL_CONFIG = {
        "host": "source-mysql",
        "port": 3306,
        "user": "root",
        "password": "",
        "database": "medikal_saasdb"
    }

    SOURCE_POSTGRES_CONFIG = {
        "host": "source-postgres",
        "port": 5432,
        "user": "postgres",
        "password": "postgres",
        "database": "postgres"
    }

    TARGET_OMOP_CONFIG = {
        "host": "target-omop",
        "port": 5432,
        "user": "postgres",
        "password": "postgres",
        "database": "postgres"
    }
else:
    SOURCE_MYSQL_CONFIG = {
        "host": "localhost",
        "port": 3307,
        "user": "root",
        "password": "",  # Empty root password in Docker MariaDB config
        "database": "medikal_saasdb"
    }

    SOURCE_POSTGRES_CONFIG = {
        "host": "localhost",
        "port": 5433,
        "user": "postgres",
        "password": "postgres",
        "database": "postgres"
    }

    TARGET_OMOP_CONFIG = {
        "host": "localhost",
        "port": 5434,
        "user": "postgres",
        "password": "postgres",
        "database": "postgres"
    }

# De-identification Cryptographic Settings
# CHANGE THIS SALT FOR PRODUCTION RUNS
SALT = "WestAfricaMedicalAnonymizationSalt2026!"

# Date shifting range (days)
MIN_DATE_SHIFT = 10
MAX_DATE_SHIFT = 365

# Migration Cutoff Date (Hospitals migration occurred around March 2026)
# We will use this to deduplicate overlapping records between MySQL and Supabase
MIGRATION_CUTOFF_DATE = "2026-03-01 00:00:00"

# Path to downloaded Athena Vocabularies
VOCABULARY_DIR = r"C:\Projects\Medikal OMOP\vocabularies"
