#![allow(missing_docs)]

pub type SoundCardID = u8;
pub type DeviceID = u8;
pub type ControllerID = u8;

#[derive(Clone, Debug, PartialEq)]
pub enum FileAccess {
    All,
    Some(Vec<u8>),
    None,
}

#[derive(Clone, Debug, PartialEq)]
pub enum ControllerAccess {
    All,
    Some(Vec<ControllerID>),
    None,
}

#[derive(Clone, Debug, PartialEq)]
pub enum SoundCardAccess {
    All,
    Some(Vec<SoundCardID>),
    None,
}

#[derive(Clone, Debug, PartialEq)]
pub enum MouseAccess {
    Yes,
    No,
}

#[derive(Clone, Debug, PartialEq)]
pub enum KeyboardAccess {
    Yes,
    No,
}

#[derive(Clone, Debug, PartialEq)]
pub enum NetworkAccess {
    Yes,
    No,
}

/// A set of capabilities that a process has
#[derive(Clone, Debug, PartialEq)]
pub struct Capabilities {
    // TODO: Add more capabilities
    pub files: FileAccess,
    pub mouse: MouseAccess,
    pub keyboard: KeyboardAccess,
    pub controllers: ControllerAccess,
    pub sound_cards: SoundCardAccess,
    pub network_access: NetworkAccess,
}

impl Capabilities {
    /// Generate a set of empty capabilities
    pub fn empty() -> Self {
        Self {
            files: FileAccess::None,
            mouse: MouseAccess::No,
            keyboard: KeyboardAccess::No,
            controllers: ControllerAccess::None,
            sound_cards: SoundCardAccess::None,
            network_access: NetworkAccess::No,
        }
    }

    /// Generate a set of capabilities that allows all access
    /// to all devices
    ///
    /// # Safety
    /// This is a very dangerous function and should not be used
    /// unless you know what you are doing
    pub unsafe fn all() -> Self {
        Self {
            files: FileAccess::All,
            mouse: MouseAccess::Yes,
            keyboard: KeyboardAccess::Yes,
            controllers: ControllerAccess::All,
            sound_cards: SoundCardAccess::All,
            network_access: NetworkAccess::Yes,
        }
    }
}
