from dataclasses import dataclass, field
from pathlib import Path
from typing import Dict, List, Optional


@dataclass
class Skill:
    """Represents an Agent Skill following agentskills.io standard."""

    name: str
    description: str
    version: str = "1.0.0"
    categories: List[str] = field(default_factory=list)
    tags: List[str] = field(default_factory=list)
    author: str = "pygeai"
    license: Optional[str] = None
    compatibility: Optional[str] = None
    metadata: Dict[str, str] = field(default_factory=dict)
    allowed_tools: List[str] = field(default_factory=list)
    instructions: str = ""
    path: Optional[Path] = None

    @property
    def category(self) -> str:
        """Get primary skill category."""
        return self.categories[0] if self.categories else "other"


@dataclass
class Agent:
    """Represents a coding agent configuration."""

    name: str
    project_skills_dir: Path
    global_skills_dir: Path

    @property
    def display_name(self) -> str:
        """Human-readable name."""
        return self.name.replace("-", " ").title()


@dataclass
class SkillLocation:
    """Represents where a skill is installed."""

    agent: Agent
    skill: Skill
    is_global: bool
    path: Path
