//! Skill data types loaded from `~/.capo/agent/skills/` and
//! `<project>/.capo/skills/`. See design spec §5.4 and brief §2.

use std::path::PathBuf;

/// Where a skill was discovered. Used for diagnostics + project-overrides-global precedence.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SkillSource {
    Global,
    Project,
}

/// One loaded skill.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Skill {
    /// Validated name (lowercase a-z, 0-9, hyphens only; ≤64 chars).
    pub name: String,
    /// Validated description (non-empty; ≤1024 chars).
    pub description: String,
    /// Absolute path to the markdown file. Sent to the LLM as `<location>`.
    pub file_path: PathBuf,
    /// Parent directory of `file_path`. Relative paths in the body resolve against this.
    pub base_dir: PathBuf,
    /// When true, omitted from `<available_skills>` and only invokable via `/skill:<name>`.
    pub disable_model_invocation: bool,
    /// Source bucket for diagnostics.
    pub source: SkillSource,
}

/// Non-fatal load issue. Caller logs via `tracing::warn!` and continues.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct SkillDiagnostic {
    pub file_path: PathBuf,
    pub message: String,
}

/// Aggregated load result.
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct LoadSkillsResult {
    pub skills: Vec<Skill>,
    pub diagnostics: Vec<SkillDiagnostic>,
}
