from dataclasses import dataclass
from pathlib import Path


@dataclass(frozen=True)
class RuntimePaths:
    project_root: Path
    notebook: Path
    data_dir: Path
    output_dir: Path

    def ensure_outputs(self) -> None:
        (self.output_dir / "figures").mkdir(parents=True, exist_ok=True)
        (self.output_dir / "tables").mkdir(parents=True, exist_ok=True)
        (self.output_dir / "predictions").mkdir(parents=True, exist_ok=True)

    def as_injection(self) -> dict:
        return {
            "DATA_DIR": str(self.data_dir),
            "OUTPUT_DIR": str(self.output_dir),
        }


def build_paths() -> RuntimePaths:
    root = Path(__file__).resolve().parents[1]
    return RuntimePaths(
        project_root=root,
        notebook=root / "notebooks" / "insurance_premium_risk.ipynb",
        data_dir=root / "dataset_final",
        output_dir=root / "outputs",
    )
