"""
Config: a provenance-aware dict (not Pydantic).

Use this when you want flexible nested data from TOML/JSON/YAML, attribute
access like cfg.database.host, and provenance for where values were loaded from.
This is not a substitute for pydantic-settings: there are no declared fields,
environment-variable overrides, or automatic coercion beyond what the file parser does.
"""

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 pi_conf import load_config


def main() -> None:
    path = Path(__file__).resolve().parent / "sample_config.toml"
    cfg = load_config(path=str(path))

    print("Config (dict-like + attributes)")
    print(f"  app_name: {cfg.app_name!r}")
    print(f"  port: {cfg.port}")
    print(f"  database.host: {cfg.database.host!r}")
    print(f"  provenance entries: {len(cfg.provenance)}")


if __name__ == "__main__":
    main()
