// 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, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AstalNetworkConnectivity")]
pub enum Connectivity {
    #[doc(alias = "ASTAL_NETWORK_CONNECTIVITY_UNKNOWN")]
    Unknown,
    #[doc(alias = "ASTAL_NETWORK_CONNECTIVITY_NONE")]
    None,
    #[doc(alias = "ASTAL_NETWORK_CONNECTIVITY_PORTAL")]
    Portal,
    #[doc(alias = "ASTAL_NETWORK_CONNECTIVITY_LIMITED")]
    Limited,
    #[doc(alias = "ASTAL_NETWORK_CONNECTIVITY_FULL")]
    Full,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::AstalNetworkConnectivity {
        match self {
            Self::Unknown => ffi::ASTAL_NETWORK_CONNECTIVITY_UNKNOWN,
            Self::None => ffi::ASTAL_NETWORK_CONNECTIVITY_NONE,
            Self::Portal => ffi::ASTAL_NETWORK_CONNECTIVITY_PORTAL,
            Self::Limited => ffi::ASTAL_NETWORK_CONNECTIVITY_LIMITED,
            Self::Full => ffi::ASTAL_NETWORK_CONNECTIVITY_FULL,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AstalNetworkConnectivity> for Connectivity {
    #[inline]
    unsafe fn from_glib(value: ffi::AstalNetworkConnectivity) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::ASTAL_NETWORK_CONNECTIVITY_UNKNOWN => Self::Unknown,
            ffi::ASTAL_NETWORK_CONNECTIVITY_NONE => Self::None,
            ffi::ASTAL_NETWORK_CONNECTIVITY_PORTAL => Self::Portal,
            ffi::ASTAL_NETWORK_CONNECTIVITY_LIMITED => Self::Limited,
            ffi::ASTAL_NETWORK_CONNECTIVITY_FULL => Self::Full,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for Connectivity {
    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 Connectivity {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for Connectivity {
    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 Connectivity {
    #[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<Connectivity> for glib::Value {
    #[inline]
    fn from(v: Connectivity) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AstalNetworkDeviceState")]
pub enum DeviceState {
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_UNKNOWN")]
    Unknown,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_UNMANAGED")]
    Unmanaged,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_UNAVAILABLE")]
    Unavailable,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_DISCONNECTED")]
    Disconnected,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_PREPARE")]
    Prepare,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_CONFIG")]
    Config,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_NEED_AUTH")]
    NeedAuth,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_IP_CONFIG")]
    IpConfig,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_IP_CHECK")]
    IpCheck,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_SECONDARIES")]
    Secondaries,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_ACTIVATED")]
    Activated,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_DEACTIVATING")]
    Deactivating,
    #[doc(alias = "ASTAL_NETWORK_DEVICE_STATE_FAILED")]
    Failed,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    fn into_glib(self) -> ffi::AstalNetworkDeviceState {
        match self {
            Self::Unknown => ffi::ASTAL_NETWORK_DEVICE_STATE_UNKNOWN,
            Self::Unmanaged => ffi::ASTAL_NETWORK_DEVICE_STATE_UNMANAGED,
            Self::Unavailable => ffi::ASTAL_NETWORK_DEVICE_STATE_UNAVAILABLE,
            Self::Disconnected => ffi::ASTAL_NETWORK_DEVICE_STATE_DISCONNECTED,
            Self::Prepare => ffi::ASTAL_NETWORK_DEVICE_STATE_PREPARE,
            Self::Config => ffi::ASTAL_NETWORK_DEVICE_STATE_CONFIG,
            Self::NeedAuth => ffi::ASTAL_NETWORK_DEVICE_STATE_NEED_AUTH,
            Self::IpConfig => ffi::ASTAL_NETWORK_DEVICE_STATE_IP_CONFIG,
            Self::IpCheck => ffi::ASTAL_NETWORK_DEVICE_STATE_IP_CHECK,
            Self::Secondaries => ffi::ASTAL_NETWORK_DEVICE_STATE_SECONDARIES,
            Self::Activated => ffi::ASTAL_NETWORK_DEVICE_STATE_ACTIVATED,
            Self::Deactivating => ffi::ASTAL_NETWORK_DEVICE_STATE_DEACTIVATING,
            Self::Failed => ffi::ASTAL_NETWORK_DEVICE_STATE_FAILED,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AstalNetworkDeviceState> for DeviceState {
    unsafe fn from_glib(value: ffi::AstalNetworkDeviceState) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::ASTAL_NETWORK_DEVICE_STATE_UNKNOWN => Self::Unknown,
            ffi::ASTAL_NETWORK_DEVICE_STATE_UNMANAGED => Self::Unmanaged,
            ffi::ASTAL_NETWORK_DEVICE_STATE_UNAVAILABLE => Self::Unavailable,
            ffi::ASTAL_NETWORK_DEVICE_STATE_DISCONNECTED => Self::Disconnected,
            ffi::ASTAL_NETWORK_DEVICE_STATE_PREPARE => Self::Prepare,
            ffi::ASTAL_NETWORK_DEVICE_STATE_CONFIG => Self::Config,
            ffi::ASTAL_NETWORK_DEVICE_STATE_NEED_AUTH => Self::NeedAuth,
            ffi::ASTAL_NETWORK_DEVICE_STATE_IP_CONFIG => Self::IpConfig,
            ffi::ASTAL_NETWORK_DEVICE_STATE_IP_CHECK => Self::IpCheck,
            ffi::ASTAL_NETWORK_DEVICE_STATE_SECONDARIES => Self::Secondaries,
            ffi::ASTAL_NETWORK_DEVICE_STATE_ACTIVATED => Self::Activated,
            ffi::ASTAL_NETWORK_DEVICE_STATE_DEACTIVATING => Self::Deactivating,
            ffi::ASTAL_NETWORK_DEVICE_STATE_FAILED => Self::Failed,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for DeviceState {
    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 DeviceState {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for DeviceState {
    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 DeviceState {
    #[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<DeviceState> for glib::Value {
    #[inline]
    fn from(v: DeviceState) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AstalNetworkInternet")]
pub enum Internet {
    #[doc(alias = "ASTAL_NETWORK_INTERNET_CONNECTED")]
    Connected,
    #[doc(alias = "ASTAL_NETWORK_INTERNET_CONNECTING")]
    Connecting,
    #[doc(alias = "ASTAL_NETWORK_INTERNET_DISCONNECTED")]
    Disconnected,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::AstalNetworkInternet {
        match self {
            Self::Connected => ffi::ASTAL_NETWORK_INTERNET_CONNECTED,
            Self::Connecting => ffi::ASTAL_NETWORK_INTERNET_CONNECTING,
            Self::Disconnected => ffi::ASTAL_NETWORK_INTERNET_DISCONNECTED,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AstalNetworkInternet> for Internet {
    #[inline]
    unsafe fn from_glib(value: ffi::AstalNetworkInternet) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::ASTAL_NETWORK_INTERNET_CONNECTED => Self::Connected,
            ffi::ASTAL_NETWORK_INTERNET_CONNECTING => Self::Connecting,
            ffi::ASTAL_NETWORK_INTERNET_DISCONNECTED => Self::Disconnected,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for Internet {
    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 Internet {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for Internet {
    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 Internet {
    #[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<Internet> for glib::Value {
    #[inline]
    fn from(v: Internet) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AstalNetworkPrimary")]
pub enum Primary {
    #[doc(alias = "ASTAL_NETWORK_PRIMARY_UNKNOWN")]
    Unknown,
    #[doc(alias = "ASTAL_NETWORK_PRIMARY_WIRED")]
    Wired,
    #[doc(alias = "ASTAL_NETWORK_PRIMARY_WIFI")]
    Wifi,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::AstalNetworkPrimary {
        match self {
            Self::Unknown => ffi::ASTAL_NETWORK_PRIMARY_UNKNOWN,
            Self::Wired => ffi::ASTAL_NETWORK_PRIMARY_WIRED,
            Self::Wifi => ffi::ASTAL_NETWORK_PRIMARY_WIFI,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AstalNetworkPrimary> for Primary {
    #[inline]
    unsafe fn from_glib(value: ffi::AstalNetworkPrimary) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::ASTAL_NETWORK_PRIMARY_UNKNOWN => Self::Unknown,
            ffi::ASTAL_NETWORK_PRIMARY_WIRED => Self::Wired,
            ffi::ASTAL_NETWORK_PRIMARY_WIFI => Self::Wifi,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for Primary {
    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 Primary {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for Primary {
    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 Primary {
    #[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<Primary> for glib::Value {
    #[inline]
    fn from(v: Primary) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "AstalNetworkState")]
pub enum State {
    #[doc(alias = "ASTAL_NETWORK_STATE_UNKNOWN")]
    Unknown,
    #[doc(alias = "ASTAL_NETWORK_STATE_ASLEEP")]
    Asleep,
    #[doc(alias = "ASTAL_NETWORK_STATE_DISCONNECTED")]
    Disconnected,
    #[doc(alias = "ASTAL_NETWORK_STATE_DISCONNECTING")]
    Disconnecting,
    #[doc(alias = "ASTAL_NETWORK_STATE_CONNECTING")]
    Connecting,
    #[doc(alias = "ASTAL_NETWORK_STATE_CONNECTED_LOCAL")]
    ConnectedLocal,
    #[doc(alias = "ASTAL_NETWORK_STATE_CONNECTED_SITE")]
    ConnectedSite,
    #[doc(alias = "ASTAL_NETWORK_STATE_CONNECTED_GLOBAL")]
    ConnectedGlobal,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::AstalNetworkState {
        match self {
            Self::Unknown => ffi::ASTAL_NETWORK_STATE_UNKNOWN,
            Self::Asleep => ffi::ASTAL_NETWORK_STATE_ASLEEP,
            Self::Disconnected => ffi::ASTAL_NETWORK_STATE_DISCONNECTED,
            Self::Disconnecting => ffi::ASTAL_NETWORK_STATE_DISCONNECTING,
            Self::Connecting => ffi::ASTAL_NETWORK_STATE_CONNECTING,
            Self::ConnectedLocal => ffi::ASTAL_NETWORK_STATE_CONNECTED_LOCAL,
            Self::ConnectedSite => ffi::ASTAL_NETWORK_STATE_CONNECTED_SITE,
            Self::ConnectedGlobal => ffi::ASTAL_NETWORK_STATE_CONNECTED_GLOBAL,
            Self::__Unknown(value) => value,
        }
    }
}

#[doc(hidden)]
impl FromGlib<ffi::AstalNetworkState> for State {
    #[inline]
    unsafe fn from_glib(value: ffi::AstalNetworkState) -> Self {
        skip_assert_initialized!();

        match value {
            ffi::ASTAL_NETWORK_STATE_UNKNOWN => Self::Unknown,
            ffi::ASTAL_NETWORK_STATE_ASLEEP => Self::Asleep,
            ffi::ASTAL_NETWORK_STATE_DISCONNECTED => Self::Disconnected,
            ffi::ASTAL_NETWORK_STATE_DISCONNECTING => Self::Disconnecting,
            ffi::ASTAL_NETWORK_STATE_CONNECTING => Self::Connecting,
            ffi::ASTAL_NETWORK_STATE_CONNECTED_LOCAL => Self::ConnectedLocal,
            ffi::ASTAL_NETWORK_STATE_CONNECTED_SITE => Self::ConnectedSite,
            ffi::ASTAL_NETWORK_STATE_CONNECTED_GLOBAL => Self::ConnectedGlobal,
            value => Self::__Unknown(value),
        }
    }
}

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

impl glib::HasParamSpec for State {
    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 State {
    type Type = Self;
}

unsafe impl<'a> glib::value::FromValue<'a> for State {
    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 State {
    #[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<State> for glib::Value {
    #[inline]
    fn from(v: State) -> Self {
        skip_assert_initialized!();
        ToValue::to_value(&v)
    }
}
