"""DAG fixtures for testing causal and graph modules.

Provides:
- SIMPLE_DAG: 5-node acyclic graph
- COMPLEX_DAG: 16-node multi-layer causal DAG
- CYCLIC_GRAPH: graph with a cycle for cycle-detection tests
"""

from __future__ import annotations

# ---------------------------------------------------------------------------
# Simple DAG (5 nodes)
# ---------------------------------------------------------------------------
#
#   A --> B --> D
#   |         ^
#   +-> C -+
#       |
#       +-> E
#
SIMPLE_DAG: dict[str, list[str]] = {
    "A": ["B", "C"],
    "B": ["D"],
    "C": ["D", "E"],
    "D": [],
    "E": [],
}

# ---------------------------------------------------------------------------
# Complex DAG (16 nodes) — multi-layer causal credit-risk model
# ---------------------------------------------------------------------------
#
# Layer 0 (exogenous):   GDP, UnemploymentRate, InterestRate, HousingIndex
# Layer 1 (mediators):   BorrowerIncome, PropertyValue, CreditDemand, MarketStress
# Layer 2 (risk):        CreditScore, LTV, DTI, DelinquencyRisk
# Layer 3 (outcomes):    ProbDefault, LossGivenDefault, ExposureAtDefault
# Layer 4 (portfolio):   ExpectedLoss
#
COMPLEX_DAG: dict[str, list[str]] = {
    # Exogenous
    "GDP": ["BorrowerIncome", "CreditDemand", "MarketStress"],
    "UnemploymentRate": ["BorrowerIncome", "DelinquencyRisk", "MarketStress"],
    "InterestRate": ["CreditDemand", "LTV", "MarketStress"],
    "HousingIndex": ["PropertyValue", "LTV"],
    # Mediators
    "BorrowerIncome": ["CreditScore", "DTI"],
    "PropertyValue": ["LTV", "LossGivenDefault"],
    "CreditDemand": ["ExposureAtDefault"],
    "MarketStress": ["DelinquencyRisk", "LossGivenDefault"],
    # Risk
    "CreditScore": ["ProbDefault"],
    "LTV": ["ProbDefault", "LossGivenDefault"],
    "DTI": ["ProbDefault", "DelinquencyRisk"],
    "DelinquencyRisk": ["ProbDefault"],
    # Outcomes
    "ProbDefault": ["ExpectedLoss"],
    "LossGivenDefault": ["ExpectedLoss"],
    "ExposureAtDefault": ["ExpectedLoss"],
    # Portfolio
    "ExpectedLoss": [],
}

# ---------------------------------------------------------------------------
# Cyclic graph (for cycle-detection tests)
# ---------------------------------------------------------------------------
#
#   X --> Y --> Z --> X   (cycle: X -> Y -> Z -> X)
#         |
#         +-> W
#
CYCLIC_GRAPH: dict[str, list[str]] = {
    "X": ["Y"],
    "Y": ["Z", "W"],
    "Z": ["X"],
    "W": [],
}
