//! LLM integration module for file editing via tool calling.

pub mod claude;
pub mod contract_tools;
pub mod groq;
pub mod markdown;
pub mod mesh_tools;
pub mod phase_guidance;
pub mod task_output;
pub mod templates;
pub mod tools;
pub mod transcript_analyzer;

pub use claude::{ClaudeClient, ClaudeModel};
pub use contract_tools::{
    parse_contract_tool_call, ChainedTaskDef, ContractToolExecutionResult, ContractToolRequest,
    CONTRACT_TOOLS,
};
pub use groq::GroqClient;
pub use mesh_tools::{parse_mesh_tool_call, MeshToolExecutionResult, MeshToolRequest, MESH_TOOLS};
pub use phase_guidance::{
    check_deliverables_met, format_checklist_markdown, generate_deliverable_prompt_guidance,
    get_next_phase_for_contract, get_phase_checklist_for_type, get_phase_deliverables,
    get_phase_deliverables_for_type, should_auto_progress, AutoProgressAction, AutoProgressDecision,
    Deliverable, DeliverableCheckResult, DeliverableItem, DeliverablePriority, DeliverableStatus,
    PhaseChecklist, PhaseDeliverables, TaskInfo, TaskStats,
};
pub use task_output::{
    analyze_task_output, format_parsed_tasks, parse_tasks_from_breakdown, ParsedTask,
    PhaseImpact, SuggestedAction, TaskOutputAnalysis, TaskParseResult,
};
pub use markdown::{body_to_markdown, markdown_to_body};
pub use templates::{all_contract_types, ContractTypeTemplate};
pub use tools::{
    execute_tool_call, Tool, ToolCall, ToolResult, UserAnswer, UserQuestion, VersionToolRequest,
    AVAILABLE_TOOLS,
};
pub use transcript_analyzer::{
    TranscriptAnalysisResult, ExtractedRequirement, ExtractedDecision,
    ExtractedActionItem, SpeakerStats, format_transcript_for_analysis,
    calculate_speaker_stats, build_analysis_prompt, parse_analysis_response,
};

/// Available LLM providers and models
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum LlmModel {
    /// Claude Sonnet 4.5 - balanced speed and capability
    ClaudeSonnet,
    /// Claude Opus 4.5 (default) - most capable
    #[default]
    ClaudeOpus,
    /// Groq Kimi - fast alternative provider
    GroqKimi,
}

impl LlmModel {
    pub fn from_str(s: &str) -> Option<Self> {
        match s.to_lowercase().as_str() {
            "claude-sonnet" | "sonnet" | "claude" => Some(LlmModel::ClaudeSonnet),
            "claude-opus" | "opus" => Some(LlmModel::ClaudeOpus),
            "groq" | "kimi" | "groq-kimi" => Some(LlmModel::GroqKimi),
            _ => None,
        }
    }
}
