use std::path::PathBuf;
use thiserror::Error;
#[derive(Error, Debug)]
pub enum Error {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("Failed to parse migration file {path}: {reason}")]
ParseError { path: PathBuf, reason: String },
#[error("Migration file not found: {0}")]
NotFound(PathBuf),
#[error("Invalid migration sequence: expected {expected}, found {found}")]
InvalidSequence { expected: u32, found: u32 },
#[error("Checksum mismatch for migration {id}: expected {expected}, found {actual}")]
ChecksumMismatch {
id: u32,
expected: String,
actual: String,
},
#[error("Migration {0} has already been applied")]
AlreadyApplied(u32),
#[error("Invalid migration name: {0}")]
InvalidName(String),
#[error("Lock file error: {0}")]
LockFile(String),
#[error("TOML error: {0}")]
Toml(#[from] toml::de::Error),
#[error("TOML serialization error: {0}")]
TomlSer(#[from] toml::ser::Error),
}
pub type Result<T> = std::result::Result<T, Error>;