import uuid
from datetime import datetime

from pydantic import BaseModel


# ---------- Request ----------

class ProjectCreateRequest(BaseModel):
    brand_name: str
    brand_url: str
    description: str | None = None


class StageUpdateRequest(BaseModel):
    status: str | None = None
    notes: str | None = None
    metrics: dict | None = None


# ---------- Response ----------

class StageDetailResponse(BaseModel):
    id: uuid.UUID
    project_id: uuid.UUID
    stage_number: int
    status: str
    started_at: datetime | None
    completed_at: datetime | None
    notes: str | None
    metrics: dict | None

    model_config = {"from_attributes": True}


class ProjectResponse(BaseModel):
    id: uuid.UUID
    organization_id: uuid.UUID
    brand_name: str
    brand_aliases: list
    current_stage: int
    status: str
    created_by: uuid.UUID | None
    created_at: datetime
    updated_at: datetime
    stages: list[StageDetailResponse] = []

    model_config = {"from_attributes": True}


class ProjectStatsResponse(BaseModel):
    total_projects: int
    active_projects: int
    stage_distribution: dict[str, int]
    completion_rate: float


class QuickStartResponse(BaseModel):
    project: ProjectResponse
    message: str


class TimelineEvent(BaseModel):
    event_type: str
    description: str
    timestamp: datetime
    stage_number: int | None = None
