#[derive(Clone, Copy, Debug)]
/// The available sizes for thumbnails.
pub enum ThumbSize {
    Normal,
    Large,
    XLarge,
    XXLarge,
}

impl ThumbSize {
    /// Static function which returns all available thumb sizes in order from biggest to smallest.
    pub fn order() -> [ThumbSize; 4] {
        [
            ThumbSize::XXLarge,
            ThumbSize::XLarge,
            ThumbSize::Large,
            ThumbSize::Normal,
        ]
    }

    /// Returns the edge length in pixels.
    pub fn max_thumb_width(&self) -> u32 {
        match self {
            ThumbSize::Normal => 128,
            ThumbSize::Large => 256,
            ThumbSize::XLarge => 512,
            ThumbSize::XXLarge => 1024,
        }
    }

    /// Returns the size-specific sub-directory name.
    pub fn dir_name(&self) -> &str {
        match self {
            ThumbSize::Normal => "normal",
            ThumbSize::Large => "large",
            ThumbSize::XLarge => "x-large",
            ThumbSize::XXLarge => "xx-large",
        }
    }
}
