"""Auto-generated from LOOM_CONTRACT.md by contract_compiler.py vv1.1.0"""

from pydantic import BaseModel, Field
from datetime import datetime
from typing import List, Dict, Optional, Any

class ConstraintReceipt(BaseModel):
    """Downstream constraint emission."""

    # Standard receipt fields
    receipt_id: str
    receipt_type: str = "constraint.v1"
    loomdip: str = "pending"
    signature: str = "unsigned"
    valid_time: datetime = Field(default_factory=datetime.utcnow)
    tier: str = "SIGNED"

    # Constraint-specific fields
    subject_id: str  # Actor being constrained
    reputation_update_id: str  # Triggering reputation update
    constraint_type: str  # "rate_limit", "read_only", etc.
    restriction: str  # Human-readable constraint
    active: bool  # Whether constraint is enforced
    reason: str  # Why constraint applied
