from __future__ import annotations

from dataclasses import dataclass
from typing import Literal

from pydantic import BaseModel, Field


class DecisionModel(BaseModel):
    action: Literal["reply", "quote", "transfer", "noop", "update_state"] = Field(description="唯一动作")
    reply: str = Field(default="", description="给客户的回复")
    transfer_msg: str = Field(default="", description="转人工提示")
    quote_mode: Literal["flush_pending", "analyze_current_or_recent", "collect_only", ""] = Field(default="")
    state_patch: dict = Field(default_factory=dict, description="状态增量")
    reason: str = Field(default="", description="内部原因")


class RouteModel(BaseModel):
    route: Literal["pre_sales", "quote", "after_sales", "risk"] = Field(description="路由目标")
    reason: str = Field(default="")


@dataclass
class Decision:
    action: str
    reply: str = ""
    transfer_msg: str = ""
    quote_mode: str = ""
    state_patch: dict | None = None
    reason: str = ""
