from __future__ import annotations from datetime import datetime from uuid import UUID from pydantic import BaseModel, ConfigDict, Field # ── Mandate Step ───────────────────────────────────────────────── class MandateStepCreate(BaseModel): """Payload for creating a step within a mandate process.""" step_order: int = Field(..., ge=0) step_type: str = Field( ..., max_length=32, description="formulation, candidacy, vote, assignment, reporting, completion, revocation", ) title: str | None = Field(default=None, max_length=256) description: str | None = None class MandateStepOut(BaseModel): """Full mandate step representation.""" model_config = ConfigDict(from_attributes=True) id: UUID mandate_id: UUID step_order: int step_type: str title: str | None = None description: str | None = None status: str vote_session_id: UUID | None = None outcome: str | None = None created_at: datetime # ── Mandate ────────────────────────────────────────────────────── class MandateCreate(BaseModel): """Payload for creating a new mandate.""" title: str = Field(..., min_length=1, max_length=256) description: str | None = None mandate_type: str = Field(..., max_length=64, description="techcomm, smith, custom") decision_id: UUID | None = None class MandateOut(BaseModel): """Full mandate representation returned by the API.""" model_config = ConfigDict(from_attributes=True) id: UUID title: str description: str | None = None mandate_type: str status: str mandatee_id: UUID | None = None decision_id: UUID | None = None starts_at: datetime | None = None ends_at: datetime | None = None created_at: datetime updated_at: datetime steps: list[MandateStepOut] = Field(default_factory=list)