"""Stage 1 — the per-clip strict-PD provenance record (spec §3.1).

Captured at source time so license + source + URL travel with the media. The
'no explicit license -> assume PD, verify' trap (scales design §2.1) applies:
"free stock" (Pexels/Pixabay) is NOT public domain.
"""

from __future__ import annotations

from dataclasses import asdict, dataclass


@dataclass(frozen=True)
class Provenance:
    scale: str
    license: str
    source: str
    url: str
    fetched_at: str          # ISO date; passed in (no clock here -> deterministic)

    def to_dict(self) -> dict:
        return asdict(self)

    @classmethod
    def from_dict(cls, d: dict) -> "Provenance":
        return cls(
            scale=d["scale"], license=d["license"], source=d["source"],
            url=d["url"], fetched_at=d["fetched_at"],
        )
