from pathlib import Path


def test_parallel_postgres_stack_assets_are_present_and_conflict_free():
    root = Path(__file__).resolve().parents[1]
    compose_yaml = (root / "deployment" / "docker-compose.parallel.server.yml").read_text(encoding="utf-8")
    env_template = (root / ".env.postgres.parallel.server.template").read_text(encoding="utf-8")
    gitignore = (root / ".gitignore").read_text(encoding="utf-8")

    assert "name: call-center-pg" in compose_yaml
    assert "image: call-center-app:pg-parallel" in compose_yaml
    assert "../.env.production" in compose_yaml
    assert "../.env.postgres.parallel.server" in compose_yaml
    assert "../.data_pg_parallel:/app/.data_pg_parallel" in compose_yaml
    assert "SCHEMA_MANAGEMENT_MODE: migrations" in compose_yaml
    assert "18080:8000" in compose_yaml
    assert "9019:9019" not in compose_yaml
    assert "4573:4573" not in compose_yaml

    assert "CC_DATA_DIR=.data_pg_parallel" in env_template
    assert "@call-center-postgres:5432/mvpcc" in env_template
    assert "LOCAL_STACK_GATEWAY_PORT=18080" in env_template
    assert "TELEGRAM_BOT_ENABLED=0" in env_template
    assert "ASTERISK_BRIDGE_ENABLED=0" in env_template
    assert "AI_VOICE_ENABLED=0" in env_template

    assert ".data_pg_parallel/" in gitignore
    assert ".env.postgres.parallel.server" in gitignore
