from __future__ import annotations

import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
    sys.path.insert(0, str(ROOT))

from app.core.install_secrets import ensure_install_secrets


def main() -> None:
    status = ensure_install_secrets()
    if status.created:
        print(f"Created install secrets at {status.path}")
        print(
            "\nIf docker compose was already started without install.env, reset the Postgres volume "
            "before the next start (local dev only — deletes DB data):\n"
            "  docker compose --profile docker-web down -v\n"
            "  docker compose --profile docker-web up -d --build"
        )
    else:
        print(f"Install secrets already exist at {status.path}")


if __name__ == "__main__":
    main()
