import uuid

from pydantic import BaseModel, ConfigDict

from hub_core.schemas.domain import DomainCreate, DomainRead, DomainRename, DomainUpdate


class RepoStub(BaseModel):
    model_config = ConfigDict(from_attributes=True)
    id: uuid.UUID
    slug: str
    name: str
    local_path: str | None = None
    remote_url: str | None = None
    status: str


class DomainDetail(DomainRead):
    """Domain with entity counts and repo list."""
    topic_count: int = 0
    workstream_count: int = 0
    ep_count: int = 0
    td_count: int = 0
    repos: list[RepoStub] = []


class DomainSummary(BaseModel):
    """Lightweight domain stats for the state summary."""
    slug: str
    name: str
    repo_count: int = 0
    active_workstream_count: int = 0
    ep_count: int = 0
    td_count: int = 0


__all__ = [
    "DomainCreate",
    "DomainDetail",
    "DomainRead",
    "DomainRename",
    "DomainSummary",
    "DomainUpdate",
    "RepoStub",
]
