# -*- coding: utf-8 -*-
"""
Pydantic 请求/响应模型 —— 通风数据解读 API
"""

from pydantic import BaseModel, Field


# ── 点选解读请求 ──

class TunClickInterpretRequest(BaseModel):
    """点选解读请求"""
    tun_id: str = Field(..., description="巷道ID")
    tun_name: str = Field(..., description="巷道名称")
    mode: str = Field("plan", description="解读模式：plan（智能体+技能，默认）或 fast（直接生成报告）")


class DeviceClickInterpretRequest(BaseModel):
    """点选解读请求"""
    device_id: str = Field(..., description="设备ID")
    device_name: str = Field(..., description="设备名称")
    device_type: str = Field(..., description="设备类型")
    mode: str = Field("plan", description="解读模式：plan（智能体+技能，默认）或 fast（直接生成报告）")


# ── 对话请求/响应 ──

class ChatRequest(BaseModel):
    """对话请求"""
    message: str = Field(..., description="用户消息")
    session_id: str | None = Field(None, description="会话ID，新会话可不传")
    thread_id: str | None = Field(None, description="LangGraph 线程ID，用于多轮对话状态恢复")


class ChatHistoryResponse(BaseModel):
    """聊天历史响应"""
    session_id: str
    messages: list[dict]
    total: int
