use crate::{panic_messages::INVALID_ENUM, sys};

/// Action to take when invited or inviting to an [`Activity`]
///
/// [`Activity`]: struct.Activity.html
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
pub enum Action {
    Join,
    Spectate,
}

#[doc(hidden)]
impl From<sys::EDiscordActivityActionType> for Action {
    fn from(source: sys::EDiscordActivityActionType) -> Self {
        match source {
            sys::DiscordActivityActionType_Join => Action::Join,
            sys::DiscordActivityActionType_Spectate => Action::Spectate,
            _ => panic!(INVALID_ENUM),
        }
    }
}

#[doc(hidden)]
impl Into<sys::EDiscordActivityActionType> for Action {
    fn into(self) -> sys::EDiscordActivityActionType {
        match self {
            Action::Join => sys::DiscordActivityActionType_Join,
            Action::Spectate => sys::DiscordActivityActionType_Spectate,
        }
    }
}
