use std::sync::Arc;

use bevy::prelude::*;

#[derive(Clone, Debug, PartialEq, Eq, Resource)]
pub struct SFX {
    pub clapping: Handle<AudioSource>,
    pub error: Handle<AudioSource>,
    pub lock: Handle<AudioSource>,
    pub set: Handle<AudioSource>,
    pub unset: Handle<AudioSource>,
}

impl SFX {

    pub fn new(assets: &Res<AssetServer>) -> Self {
        let source = include_bytes!("../../assets/clapping.wav");
        let source = AudioSource {
            bytes: Arc::new(*source),
        };
        let clapping = assets.add(source);

        let source = include_bytes!("../../assets/error.wav");
        let source = AudioSource {
            bytes: Arc::new(*source),
        };
        let error = assets.add(source);

        let source = include_bytes!("../../assets/lock.wav");
        let source = AudioSource {
            bytes: Arc::new(*source),
        };
        let lock = assets.add(source);

        let source = include_bytes!("../../assets/set.wav");
        let source = AudioSource {
            bytes: Arc::new(*source),
        };
        let set = assets.add(source);

        let source = include_bytes!("../../assets/unset.wav");
        let source = AudioSource {
            bytes: Arc::new(*source),
        };
        let unset = assets.add(source);

        Self { clapping, error, lock, set, unset }
}
}
