"""启动确认窗兜底样本的内部上报模型(pricebot → app-server)。"""
from __future__ import annotations

from datetime import datetime

from pydantic import BaseModel, ConfigDict


class LaunchConfirmSampleIn(BaseModel):
    """一次 agent 兜底的完整样本。

    字段一律宽松可空:落盘是辅助数据,绝不能因个别字段缺失就拒收(否则连累 pricebot 兜底)。
    """

    trace_id: str | None = None
    device_id: str | None = None
    host_package: str | None = None
    target_app: str | None = None
    system_locale: str | None = None
    exec_success: bool = False
    dialog_title: str | None = None
    payload: dict | None = None


class LaunchConfirmSampleOut(BaseModel):
    """落库结果。"""

    id: int


class LaunchConfirmSampleRow(BaseModel):
    """单条样本(列表读出;沉淀脚本 distill 用,payload 原样带出)。"""

    model_config = ConfigDict(from_attributes=True)

    id: int
    created_at: datetime
    trace_id: str | None = None
    device_id: str | None = None
    host_package: str | None = None
    target_app: str | None = None
    system_locale: str | None = None
    exec_success: bool = False
    dialog_title: str | None = None
    payload: dict | None = None
