"""generate_fixtures.py — run once to populate fixtures/.

NOT committed as a fixture producer; committed as a reproducibility aid.
Run from data-engineering/sample-pipeline/:
    python -m schema_evolution.generate_fixtures

Produces:
    schema_evolution/fixtures/v1.parquet  (4 cols: id, actor, repo, created_at)
    schema_evolution/fixtures/v2.parquet  (5 cols: v1 + payload_size, nullable)
    schema_evolution/fixtures/v3.parquet  (6 cols: v2 + event_type, NOT NULL)
"""

from pathlib import Path

import pyarrow as pa
import pyarrow.parquet as pq

OUT = Path(__file__).parent / "fixtures"
OUT.mkdir(exist_ok=True)

base = {
    "id": list(range(10)),
    "actor": [f"u{i}" for i in range(10)],
    "repo": [f"r{i % 3}" for i in range(10)],
    "created_at": pa.array(
        [1779753600000000] * 10, type=pa.timestamp("us")
    ),  # 2026-05-26T00:00:00 UTC as microseconds since epoch
}

pq.write_table(pa.table(base), OUT / "v1.parquet")
pq.write_table(pa.table({**base, "payload_size": [100] * 10}), OUT / "v2.parquet")
pq.write_table(
    pa.table({**base, "payload_size": [100] * 10, "event_type": ["push"] * 10}),
    OUT / "v3.parquet",
)

print("Generated v1, v2, v3 fixtures in", OUT)

if __name__ == "__main__":
    pass
