"""Schemas for AI suggestion audit trail."""
from datetime import datetime
from typing import Optional
from uuid import UUID

from pydantic import BaseModel, Field


class AISuggestionCreate(BaseModel):
    tree_id: UUID
    session_id: Optional[UUID] = None
    action_type: str
    target_node_id: Optional[str] = None
    changes_json: dict = Field(default_factory=dict)


class AISuggestionResponse(BaseModel):
    id: UUID
    tree_id: UUID
    user_id: UUID
    session_id: Optional[UUID]
    action_type: str
    target_node_id: Optional[str]
    changes_json: dict
    status: str
    created_at: datetime
    resolved_at: Optional[datetime]

    model_config = {"from_attributes": True}


class AISuggestionResolve(BaseModel):
    status: str = Field(..., pattern="^(accepted|dismissed)$")
