use std::io;
use thiserror::Error;
#[derive(Error, Debug)]
#[allow(dead_code)]
pub(crate) enum ThesaError {
#[error("invalid target '{0}'")]
InvalidTarget(String),
#[error("GitHub API returned {status}: {body}")]
ApiError { status: u16, body: String },
#[error("GitHub entity '{0}' was not found")]
NotFound(String),
#[error("repo '{0}' is private, only public repos can be cloned")]
PrivateRepo(String),
#[error("output path '{0}' is not a directory")]
OutputNotDirectory(String),
#[error("'git' executable not found in PATH")]
MissingGit,
#[error("clone failed for '{repo}': {message}")]
CloneFailed { repo: String, message: String },
#[error(
"Hugging Face API returned {status}: {body}\n hint: set HF_TOKEN env or pass --hf-token to authenticate (https://huggingface.co/settings/tokens)"
)]
HfApiError { status: u16, body: String },
#[error("Hugging Face model '{0}' was not found")]
HfNotFound(String),
#[error("Hugging Face download failed for '{model}': {message}")]
HfDownloadFailed { model: String, message: String },
#[error("Ollama API returned {status}: {body}")]
OllamaApiError { status: u16, body: String },
#[error("Ollama model '{0}' was not found")]
OllamaNotFound(String),
#[error("Ollama download failed for '{model}': {message}")]
OllamaDownloadFailed { model: String, message: String },
#[error("CivitAI API returned {status}: {body}")]
CivitaiApiError { status: u16, body: String },
#[error("CivitAI model '{0}' was not found")]
CivitaiNotFound(String),
#[error("CivitAI download failed for '{model}': {message}")]
CivitaiDownloadFailed { model: String, message: String },
#[error("'ollama' executable not found in PATH")]
MissingOllama,
#[error("{0}")]
Message(String),
#[error("I/O error: {0}")]
Io(#[from] io::Error),
#[error("request error: {0}")]
Request(#[from] reqwest::Error),
}
pub(crate) type Result<T> = std::result::Result<T, ThesaError>;