use serde::{Deserialize, Serialize};

/// A claim extracted from text or audio.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Claim {
    pub subject: String,
    pub predicate: String,
    pub object: String,
    pub confidence: f32,
    pub quote: String,
    pub source: Option<String>,
}

/// Status of a claim relative to existing knowledge.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ClaimStatus {
    New,
    Matches,
    Contradicts,
}

/// A related claim from the knowledge graph.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RelatedClaim {
    pub claim: Claim,
    pub relationship: String,
    pub source: String,
}

/// Result of checking a claim against the knowledge graph.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ClaimCheck {
    pub claim: Claim,
    pub status: ClaimStatus,
    pub related: Vec<RelatedClaim>,
}

/// Default LLM provider - must match frontend DEFAULT_SETTINGS.llmProvider
pub const DEFAULT_LLM_PROVIDER: &str = "anthropic";

/// Application settings.
/// Note: Default values must stay in sync with src/lib/defaults.ts
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Settings {
    pub llm_provider: String,
    pub api_key: Option<String>,
    pub auto_save: bool,
    pub notifications_enabled: bool,
}

impl Default for Settings {
    fn default() -> Self {
        Self {
            llm_provider: DEFAULT_LLM_PROVIDER.to_string(),
            api_key: None,
            auto_save: false,
            notifications_enabled: true,
        }
    }
}
