use thiserror::Error;
#[derive(Debug, Error)]
#[allow(dead_code)]
pub enum CoraError {
#[error("LLM API request failed: {0}")]
LlmRequest(#[from] reqwest::Error),
#[error("LLM API returned status {status}: {body}")]
LlmStatus { status: u16, body: String },
#[error("failed to parse LLM JSON response: {0}")]
LlmParse(String),
#[error("streaming error: {0}")]
LlmStream(String),
#[error("JSON repair failed: {0}")]
LlmJsonRepair(String),
#[error("config parse error: {0}")]
ConfigParse(String),
#[error("config read error: {0}")]
ConfigRead(String),
#[error("no API key found")]
NoApiKey,
#[error("diff too large ({actual} chars, max {max})")]
DiffTooLarge { actual: usize, max: usize },
#[error("invalid ref: {0}")]
InvalidRef(String),
#[error("git command `{command}` failed: {stderr}")]
GitCommand { command: String, stderr: String },
#[error("not inside a git repository")]
NotInGitRepo,
#[error("HEAD is detached — cannot determine branch name")]
HeadDetached,
#[error("cache I/O error: {0}")]
CacheIo(#[from] std::io::Error),
#[error("cache serialize error: {0}")]
CacheSerialize(String),
#[error("scanner error: {0}")]
ScannerError(String),
#[error("auth error: {0}")]
AuthError(String),
#[error("hook error: {0}")]
HookError(String),
#[error("LLM request timed out: {0}")]
Timeout(String),
}