use thiserror::Error;
pub type Result<T> = std::result::Result<T, GwError>;
#[derive(Error, Debug)]
pub enum GwError {
#[error("Not in a git repository")]
NotAGitRepository,
#[error("Git command failed: {0}")]
GitCommandFailed(String),
#[error("Branch '{0}' already exists")]
BranchAlreadyExists(String),
#[error("Branch '{0}' does not exist")]
BranchNotFound(String),
#[error("Cannot delete protected branch: {0}")]
ProtectedBranch(String),
#[error("Uncommitted changes detected. Commit or stash them first.")]
UncommittedChanges,
#[error("Branch '{0}' has {1} unpushed commit(s)")]
UnpushedCommits(String, usize),
#[error("Already on home branch '{0}'. Specify a branch to delete.")]
AlreadyOnHomeBranch(String),
#[error("Branch name is required")]
BranchNameRequired,
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Cannot undo: no commits to undo (initial commit or empty history)")]
NothingToUndo,
#[error("{0}")]
Other(String),
}