"""
Pydantic models - Generated from schema.json

DO NOT EDIT MANUALLY - Regenerate from schema.json
"""

from enum import Enum
from typing import Optional, List, Literal
from pydantic import BaseModel, Field


class Status(str, Enum):
    PENDING = "pending"
    PLANNED = "planned"
    BUILDING = "building"
    DEV = "dev"
    LIVE = "live"
    READY = "ready"


class System(str, Enum):
    ARTERY = "artery"
    ALBUM = "album"
    WARD = "ward"


class ToolType(str, Enum):
    APP = "app"
    CLI = "cli"


# === Shared Components ===

class Nest(BaseModel):
    """Runtime environment configuration. Shared across artery, ward."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    config_path: Optional[str] = None


class Larder(BaseModel):
    """Data storage. When generated from Template = 'Book (written)'. Independent in ward/artery."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    source_template: Optional[str] = None
    data_path: Optional[str] = None


# === System-Specific Components ===

class Vein(BaseModel):
    """Connector (artery). Single responsibility."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    system: Literal["artery"] = "artery"
    mock: Optional[bool] = None
    description: Optional[str] = None


class Template(BaseModel):
    """Documentation template (album). Gherkin, BDD patterns."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    template_path: Optional[str] = None
    system: Literal["album"] = "album"


class Tool(BaseModel):
    """Execution tool (ward). Test runners, seeders."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    system: Literal["ward"] = "ward"
    type: Optional[ToolType] = None
    description: Optional[str] = None
    path: Optional[str] = None
    url: Optional[str] = None
    cli: Optional[str] = None


class Monitor(BaseModel):
    """Service monitor (ward). Health checks, status watchers."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    system: Literal["ward"] = "ward"


class Cabinet(BaseModel):
    """Tool cabinet (ward). Contains 0+ tools."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    tools: List[Tool] = Field(default_factory=list)
    system: Literal["ward"] = "ward"


# === Composed Types ===

class Pulse(BaseModel):
    """Composed data flow (artery). Pulse = Vein + Nest + Larder."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    vein: Optional[Vein] = None
    nest: Optional[Nest] = None
    larder: Optional[Larder] = None
    system: Literal["artery"] = "artery"


class Book(BaseModel):
    """Composed documentation (album). Book = Template + Larder."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    template: Optional[Template] = None
    larder: Optional[Larder] = None
    output_larder: Optional[Larder] = None
    system: Literal["album"] = "album"


class Table(BaseModel):
    """Composed execution bundle (ward). Table = Cabinet + Nest + Larders."""
    name: str  # Unique identifier
    slug: str  # URL-friendly identifier
    title: str  # Display title for UI
    status: Optional[Status] = None
    cabinet: Optional[Cabinet] = None
    nest: Optional[Nest] = None
    larders: List[Larder] = Field(default_factory=list)
    system: Literal["ward"] = "ward"


# === Collection wrappers for JSON files ===

class NestCollection(BaseModel):
    items: List[Nest] = Field(default_factory=list)


class LarderCollection(BaseModel):
    items: List[Larder] = Field(default_factory=list)


class VeinCollection(BaseModel):
    items: List[Vein] = Field(default_factory=list)


class TemplateCollection(BaseModel):
    items: List[Template] = Field(default_factory=list)


class ToolCollection(BaseModel):
    items: List[Tool] = Field(default_factory=list)


class MonitorCollection(BaseModel):
    items: List[Monitor] = Field(default_factory=list)


class CabinetCollection(BaseModel):
    items: List[Cabinet] = Field(default_factory=list)


class PulseCollection(BaseModel):
    items: List[Pulse] = Field(default_factory=list)


class BookCollection(BaseModel):
    items: List[Book] = Field(default_factory=list)


class TableCollection(BaseModel):
    items: List[Table] = Field(default_factory=list)

