"""Atlas configuration helpers."""

import os
from pathlib import Path

from dotenv import load_dotenv

PROJECT_ROOT = Path(__file__).resolve().parent.parent
load_dotenv(PROJECT_ROOT / ".env")

CONFIG_DIR = PROJECT_ROOT / "config"
CONFIG_DIR.mkdir(parents=True, exist_ok=True)

ENTITY_ALIASES_FILE = Path(os.getenv("ATLAS_ENTITY_ALIASES_FILE", CONFIG_DIR / "entity_aliases.json"))
ENTITY_ALIASES_FILE.parent.mkdir(parents=True, exist_ok=True)
if not ENTITY_ALIASES_FILE.exists():
    ENTITY_ALIASES_FILE.write_text("{}\n", encoding="utf-8")
