//! Error types for archetype_asset

use thiserror::Error;

/// Main error type for asset operations
#[derive(Error, Debug)]
pub enum AssetError {
    /// Error occurred in the model subsystem
    #[error("Model error: {0}")]
    Model(#[from] crate::model::ModelError),

    /// Error occurred in the texture subsystem
    #[error("Texture error: {0}")]
    Texture(#[from] crate::texture::TextureError),

    /// Input/Output error
    #[error("IO error: {0}")]
    Io(#[from] std::io::Error),

    /// Image processing error
    #[error("Image error: {0}")]
    Image(#[from] image::ImageError),

    /// GLTF parsing error
    #[error("GLTF error: {0}")]
    Gltf(#[from] gltf::Error),

    /// The file format is not supported
    #[error("Unsupported format: {0}")]
    UnsupportedFormat(String),

    /// The data found is invalid or corrupted
    #[error("Invalid data: {0}")]
    InvalidData(String),

    /// Error occurred in the GPU subsystem
    #[error("GPU error: {0}")]
    Gpu(#[from] crate::gpu::GpuError),

    /// Error occurred in the cache subsystem
    #[error("Cache error: {0}")]
    Cache(String),
}

/// Result type alias for asset operations
pub type Result<T> = std::result::Result<T, AssetError>;
