"""Quickstart step 3 (planned Python SDK) — review and approve the inferred contract."""

import os

from tessera import Tessera

client = Tessera(base_url=os.environ["TESSERA_API_BASE"])

draft = client.api.create_contract_draft()
print(f"draft contract v{draft.version}: {draft.status.value}")
for event_type, section in sorted(draft.event_types.items()):
    roles = {key: spec.role.value for key, spec in section.attributes.items()}
    print(f"  {event_type} [{section.status.value}]: {roles}")

approved = client.api.approve_contract(draft.version)
print(f"contract v{approved.version}: {approved.status.value}")
print(f"fingerprint: {approved.fingerprint}")
client.close()
