use serde::{Deserialize, Serialize};
use symphonia::core::audio;

#[derive(Debug, PartialEq, PartialOrd, Clone, Serialize, Deserialize, Copy)]
pub enum SampleFormat {
    U8,
    U16,
    U24,
    U32,
    S8,
    S16,
    S24,
    S32,
    F32,
    F64,
}

impl From<audio::sample::SampleFormat> for SampleFormat {
    fn from(value: audio::sample::SampleFormat) -> Self {
        match value {
            audio::sample::SampleFormat::U8 => Self::U8,
            audio::sample::SampleFormat::U16 => Self::U16,
            audio::sample::SampleFormat::U24 => Self::U24,
            audio::sample::SampleFormat::U32 => Self::U32,
            audio::sample::SampleFormat::S8 => Self::S8,
            audio::sample::SampleFormat::S16 => Self::S16,
            audio::sample::SampleFormat::S24 => Self::S24,
            audio::sample::SampleFormat::S32 => Self::S32,
            audio::sample::SampleFormat::F32 => Self::F32,
            audio::sample::SampleFormat::F64 => Self::F64,
        }
    }
}
