from pydantic import BaseModel
from typing import List, Optional, Any, Literal

class Cost(BaseModel):
    amount: float
    currency: str

class Duration(BaseModel):
    min: int
    max: int
    unit: str

class NodeRule(BaseModel):
    type: Literal["WAIT", "PREREQUISITE", "TIME_WINDOW", "RETRY_LIMIT", "EXPIRY", "CONDITION"]
    condition: Optional[str] = None
    value: Any

class NodeAction(BaseModel):
    type: Literal["ACKNOWLEDGE", "CHECKBOX", "RADIO", "SIGNATURE", "INPUT", "UPLOAD", "SCHEDULE"]
    required: Optional[bool] = None
    label: Optional[str] = None

class Node(BaseModel):
    id: str
    title: str
    description: Optional[str] = None
    cost: Optional[Cost] = None
    duration: Optional[Duration] = None
    is_milestone: Optional[bool] = None
    is_divergence_point: Optional[bool] = None
    is_terminal: Optional[bool] = None
    rules: List[NodeRule] = []
    actions: List[NodeAction] = []
