// This file was generated by gir (https://github.com/gtk-rs/gir)
// from ../../girs
// from ../../gtk-girs
// DO NOT EDIT

use crate::{ffi};
use glib::{prelude::*,translate::*};

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AstalGreetAuthMessageType")]
pub enum AuthMessageType {
    /// Indicates that input from the user should be visible when they answer this question.
    #[doc(alias = "ASTAL_GREET_AUTH_MESSAGE_TYPE_VISIBLE")]
    Visible,
    /// Indicates that input from the user should be considered secret when they answer this question.
    #[doc(alias = "ASTAL_GREET_AUTH_MESSAGE_TYPE_SECRET")]
    Secret,
    /// Indicates that this message is informative, not a question.
    #[doc(alias = "ASTAL_GREET_AUTH_MESSAGE_TYPE_INFO")]
    Info,
    /// Indicates that this message is an error, not a question.
    #[doc(alias = "ASTAL_GREET_AUTH_MESSAGE_TYPE_ERROR")]
    Error,
#[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl IntoGlib for AuthMessageType {
    type GlibType = ffi::AstalGreetAuthMessageType;

    #[inline]
fn into_glib(self) -> ffi::AstalGreetAuthMessageType {
match self {
            Self::Visible => ffi::ASTAL_GREET_AUTH_MESSAGE_TYPE_VISIBLE,
            Self::Secret => ffi::ASTAL_GREET_AUTH_MESSAGE_TYPE_SECRET,
            Self::Info => ffi::ASTAL_GREET_AUTH_MESSAGE_TYPE_INFO,
            Self::Error => ffi::ASTAL_GREET_AUTH_MESSAGE_TYPE_ERROR,
            Self::__Unknown(value) => value,
}
}
}

#[doc(hidden)]
impl FromGlib<ffi::AstalGreetAuthMessageType> for AuthMessageType {
    #[inline]
unsafe fn from_glib(value: ffi::AstalGreetAuthMessageType) -> Self {
        skip_assert_initialized!();
        
match value {
            ffi::ASTAL_GREET_AUTH_MESSAGE_TYPE_VISIBLE => Self::Visible,
            ffi::ASTAL_GREET_AUTH_MESSAGE_TYPE_SECRET => Self::Secret,
            ffi::ASTAL_GREET_AUTH_MESSAGE_TYPE_INFO => Self::Info,
            ffi::ASTAL_GREET_AUTH_MESSAGE_TYPE_ERROR => Self::Error,
            value => Self::__Unknown(value),
}
}
}

impl StaticType for AuthMessageType {
                #[inline]
    #[doc(alias = "astal_greet_auth_message_type_get_type")]
   fn static_type() -> glib::Type {
                    unsafe { from_glib(ffi::astal_greet_auth_message_type_get_type()) }
                }
            }

impl glib::HasParamSpec for AuthMessageType {
                type ParamSpec = glib::ParamSpecEnum;
                type SetValue = Self;
                type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
    
                fn param_spec_builder() -> Self::BuilderFn {
                    Self::ParamSpec::builder_with_default
                }
}

impl glib::value::ValueType for AuthMessageType {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for AuthMessageType {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for AuthMessageType {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<AuthMessageType> for glib::Value {
    #[inline]
    fn from(v: AuthMessageType) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AstalGreetErrorType")]
pub enum ErrorType {
    /// Indicates that authentication failed. This is not a fatal error, and is likely caused by incorrect credentials.
    #[doc(alias = "ASTAL_GREET_ERROR_TYPE_AUTH_ERROR")]
    AuthError,
    /// A general error. See the error description for more information.
    #[doc(alias = "ASTAL_GREET_ERROR_TYPE_ERROR")]
    Error,
#[doc(hidden)]
    __Unknown(i32),
}

#[doc(hidden)]
impl IntoGlib for ErrorType {
    type GlibType = ffi::AstalGreetErrorType;

    #[inline]
fn into_glib(self) -> ffi::AstalGreetErrorType {
match self {
            Self::AuthError => ffi::ASTAL_GREET_ERROR_TYPE_AUTH_ERROR,
            Self::Error => ffi::ASTAL_GREET_ERROR_TYPE_ERROR,
            Self::__Unknown(value) => value,
}
}
}

#[doc(hidden)]
impl FromGlib<ffi::AstalGreetErrorType> for ErrorType {
    #[inline]
unsafe fn from_glib(value: ffi::AstalGreetErrorType) -> Self {
        skip_assert_initialized!();
        
match value {
            ffi::ASTAL_GREET_ERROR_TYPE_AUTH_ERROR => Self::AuthError,
            ffi::ASTAL_GREET_ERROR_TYPE_ERROR => Self::Error,
            value => Self::__Unknown(value),
}
}
}

impl StaticType for ErrorType {
                #[inline]
    #[doc(alias = "astal_greet_error_type_get_type")]
   fn static_type() -> glib::Type {
                    unsafe { from_glib(ffi::astal_greet_error_type_get_type()) }
                }
            }

impl glib::HasParamSpec for ErrorType {
                type ParamSpec = glib::ParamSpecEnum;
                type SetValue = Self;
                type BuilderFn = fn(&str, Self) -> glib::ParamSpecEnumBuilder<Self>;
    
                fn param_spec_builder() -> Self::BuilderFn {
                    Self::ParamSpec::builder_with_default
                }
}

impl glib::value::ValueType for ErrorType {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for ErrorType {
    type Checker = glib::value::GenericValueTypeChecker<Self>;

    #[inline]
    unsafe fn from_value(value: &'a glib::Value) -> Self {
        skip_assert_initialized!();
        from_glib(glib::gobject_ffi::g_value_get_enum(value.to_glib_none().0))
    }
}

impl ToValue for ErrorType {
    #[inline]
    fn to_value(&self) -> glib::Value {
        let mut value = glib::Value::for_value_type::<Self>();
        unsafe {
            glib::gobject_ffi::g_value_set_enum(value.to_glib_none_mut().0, self.into_glib());
        }
        value
    }

    #[inline]
    fn value_type(&self) -> glib::Type {
        Self::static_type()
    }
}

impl From<ErrorType> for glib::Value {
    #[inline]
    fn from(v: ErrorType) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

