from pydantic import BaseModel
from typing import Optional


class SkillCreate(BaseModel):
    name: str
    description: Optional[str] = None
    instructions: str
    agent_type: str  # master/planner/executor/librarian/analyst
    tools: list[str] = []
    required_context: list[str] = []
    output_format: Optional[str] = None
    visibility: str = "private"
    team_id: Optional[str] = None
    is_active: bool = True


class SkillUpdate(BaseModel):
    # All fields Optional
    name: Optional[str] = None
    description: Optional[str] = None
    instructions: Optional[str] = None
    agent_type: Optional[str] = None
    tools: Optional[list[str]] = None
    required_context: Optional[list[str]] = None
    output_format: Optional[str] = None
    visibility: Optional[str] = None
    team_id: Optional[str] = None
    is_active: Optional[bool] = None


class SkillOut(BaseModel):
    id: str
    name: str
    description: Optional[str]
    instructions: str
    agent_type: str
    tools: list[str]
    required_context: list[str]
    output_format: Optional[str]
    visibility: str
    team_id: Optional[str]
    is_active: bool
    owner_id: str
    created_at: str
    updated_at: str

    model_config = {"from_attributes": True}
