"""Provider-neutral, advisory project-understanding contract."""

from typing import Literal

from pydantic import BaseModel, ConfigDict, Field


class IntakeCandidate(BaseModel):
    ref: str
    name: str
    description: str = ""
    tags: list[str] = Field(default_factory=list)


class ProjectUnderstanding(BaseModel):
    model_config = ConfigDict(extra="forbid")

    decision: Literal["allow", "clarify", "out_of_scope", "blocked"]
    category: Literal[
        "website",
        "portfolio",
        "commerce",
        "booking",
        "crm",
        "portal",
        "saas",
        "operations",
        "support",
        "knowledge",
        "content",
        "dashboard",
        "other",
        "unspecified",
    ]
    summary: str = Field(max_length=800)
    requested_features: list[str] = Field(max_length=12)
    template_ref: str | None
    confidence: float = Field(ge=0, le=1, allow_inf_nan=False)


INTAKE_MESSAGES = {
    "clarify": (
        "Let's shape your idea! Tell us what website or web app you'd like to build, "
        "who it's for, and what it should do."
    ),
    "out_of_scope": (
        "We're here to build websites and web apps. "
        "Turn this into an app idea and we'll help you get started!"
    ),
    "blocked": (
        "We can't help build that request. Try a safe, legitimate website or app idea "
        "and we'll help bring it to life."
    ),
}
