from pydantic import BaseModel
from datetime import datetime
from app.models.todo import TodoSource


class TodoCreate(BaseModel):
    title: str


class TodoUpdate(BaseModel):
    title: str | None = None
    is_completed: bool | None = None


class TodoOut(BaseModel):
    id: str
    title: str
    is_completed: bool
    source: TodoSource
    source_detail: str | None
    todo_date: str
    completed_at: datetime | None
    created_at: datetime
    updated_at: datetime

    model_config = {"from_attributes": True}


class TodoListOut(BaseModel):
    items: list[TodoOut]
    total: int
    page: int
    page_size: int


class TodoSummaryOut(BaseModel):
    date: str
    total: int
    completed: int
    pending: int
