from datetime import date, datetime

from pydantic import BaseModel

from app.models.goal import GoalStatus


class GoalCreate(BaseModel):
    title: str
    goal_date: date
    note: str | None = None
    status: GoalStatus = GoalStatus.ACTIVE


class GoalUpdate(BaseModel):
    title: str | None = None
    goal_date: date | None = None
    note: str | None = None
    status: GoalStatus | None = None


class GoalOut(BaseModel):
    id: str
    title: str
    note: str | None
    goal_date: str
    status: GoalStatus
    created_at: datetime
    updated_at: datetime

    model_config = {"from_attributes": True}


class GoalListOut(BaseModel):
    items: list[GoalOut]
