use yggdrasil_abi::error::Error;

#[derive(Debug)]
pub enum AhciError {
    MemoryError(#[allow(dead_code)] Error),
    InvalidBufferSize(usize),
    RegionTooLarge,
    DeviceError,
    FeatureNotImplemented,
}

impl From<AhciError> for Error {
    fn from(value: AhciError) -> Self {
        match value {
            // TODO: Error::DeviceError
            AhciError::InvalidBufferSize(_) => Error::InvalidArgument,
            AhciError::DeviceError => Error::InvalidArgument,
            AhciError::RegionTooLarge => Error::InvalidArgument,
            AhciError::MemoryError(err) => err,
            AhciError::FeatureNotImplemented => Error::NotImplemented,
        }
    }
}
