use std::fmt::Display;

use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize, Deserialize, Clone, Copy)]
#[cfg_attr(feature = "clap", derive(clap::ValueEnum))]
pub enum ShuffleMode {
    /// Tracks are not shuffled, they are played as is
    None,

    /// Only collections are shuffled, meaning the collections are shuffled, but not the contents
    CollectionsOnly,

    /// Randomize tracks only, meaning the contents of collections are shuffled, but not the collections themselves
    TracksOnly,

    /// Randomize collection order and the tracks inside the collection
    CollectionsAndTracks,

    /// Randomizes the order of everything
    Full,
}

impl Display for ShuffleMode {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        match self {
            ShuffleMode::None => f.write_str("None"),
            ShuffleMode::CollectionsOnly => f.write_str("Collections Only"),
            ShuffleMode::TracksOnly => f.write_str("Tracks Only"),
            ShuffleMode::CollectionsAndTracks => f.write_str("Collections And Tracks"),
            ShuffleMode::Full => f.write_str("Full"),
        }
    }
}
