"""Component models"""

from typing import Any, Dict, List, Optional
from uuid import uuid4
from pydantic import BaseModel, Field, ConfigDict


class ComponentVariant(BaseModel):
    """A variant of a component (e.g., 'outline' button)"""
    model_config = ConfigDict(arbitrary_types_allowed=True)

    uuid: str = Field(default_factory=lambda: str(uuid4()), description="UUID for export/import")
    name: str = Field(..., description="Variant name")
    props: Dict[str, Any] = Field(default_factory=dict, description="Variant-specific props")


class Component(BaseModel):
    """A design system component"""
    model_config = ConfigDict(arbitrary_types_allowed=True)

    uuid: str = Field(default_factory=lambda: str(uuid4()), description="UUID for export/import")
    name: str = Field(..., description="Component name (e.g., 'Button')")
    source: str = Field(..., description="Component source (shadcn, custom, figma)")
    description: Optional[str] = Field(None, description="Component description")
    variants: List[str] = Field(default_factory=list, description="Available variants")
    props: Dict[str, Any] = Field(default_factory=dict, description="Component props schema")
    dependencies: List[str] = Field(default_factory=list, description="Component dependencies (UUIDs)")
