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

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

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "PpsJobPriority")]
pub enum JobPriority {
    #[doc(alias = "PPS_JOB_PRIORITY_URGENT")]
    PriorityUrgent,
    #[doc(alias = "PPS_JOB_PRIORITY_HIGH")]
    PriorityHigh,
    #[doc(alias = "PPS_JOB_PRIORITY_LOW")]
    PriorityLow,
    #[doc(alias = "PPS_JOB_PRIORITY_NONE")]
    PriorityNone,
    #[doc(alias = "PPS_JOB_N_PRIORITIES")]
    NPriorities,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::PpsJobPriority {
        match self {
            Self::PriorityUrgent => ffi::PPS_JOB_PRIORITY_URGENT,
            Self::PriorityHigh => ffi::PPS_JOB_PRIORITY_HIGH,
            Self::PriorityLow => ffi::PPS_JOB_PRIORITY_LOW,
            Self::PriorityNone => ffi::PPS_JOB_PRIORITY_NONE,
            Self::NPriorities => ffi::PPS_JOB_N_PRIORITIES,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::PPS_JOB_PRIORITY_URGENT => Self::PriorityUrgent,
            ffi::PPS_JOB_PRIORITY_HIGH => Self::PriorityHigh,
            ffi::PPS_JOB_PRIORITY_LOW => Self::PriorityLow,
            ffi::PPS_JOB_PRIORITY_NONE => Self::PriorityNone,
            ffi::PPS_JOB_N_PRIORITIES => Self::NPriorities,
            value => Self::__Unknown(value),
        }
    }
}

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

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

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

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "PpsPageLayout")]
pub enum PageLayout {
    #[doc(alias = "PPS_PAGE_LAYOUT_SINGLE")]
    Single,
    #[doc(alias = "PPS_PAGE_LAYOUT_DUAL")]
    Dual,
    #[doc(alias = "PPS_PAGE_LAYOUT_AUTOMATIC")]
    Automatic,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::PpsPageLayout {
        match self {
            Self::Single => ffi::PPS_PAGE_LAYOUT_SINGLE,
            Self::Dual => ffi::PPS_PAGE_LAYOUT_DUAL,
            Self::Automatic => ffi::PPS_PAGE_LAYOUT_AUTOMATIC,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::PPS_PAGE_LAYOUT_SINGLE => Self::Single,
            ffi::PPS_PAGE_LAYOUT_DUAL => Self::Dual,
            ffi::PPS_PAGE_LAYOUT_AUTOMATIC => Self::Automatic,
            value => Self::__Unknown(value),
        }
    }
}

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

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

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

#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)]
#[non_exhaustive]
#[doc(alias = "PpsSizingMode")]
pub enum SizingMode {
    #[doc(alias = "PPS_SIZING_FIT_PAGE")]
    FitPage,
    #[doc(alias = "PPS_SIZING_FIT_WIDTH")]
    FitWidth,
    #[doc(alias = "PPS_SIZING_FREE")]
    Free,
    #[doc(alias = "PPS_SIZING_AUTOMATIC")]
    Automatic,
    #[doc(hidden)]
    __Unknown(i32),
}

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

    #[inline]
    fn into_glib(self) -> ffi::PpsSizingMode {
        match self {
            Self::FitPage => ffi::PPS_SIZING_FIT_PAGE,
            Self::FitWidth => ffi::PPS_SIZING_FIT_WIDTH,
            Self::Free => ffi::PPS_SIZING_FREE,
            Self::Automatic => ffi::PPS_SIZING_AUTOMATIC,
            Self::__Unknown(value) => value,
        }
    }
}

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

        match value {
            ffi::PPS_SIZING_FIT_PAGE => Self::FitPage,
            ffi::PPS_SIZING_FIT_WIDTH => Self::FitWidth,
            ffi::PPS_SIZING_FREE => Self::Free,
            ffi::PPS_SIZING_AUTOMATIC => Self::Automatic,
            value => Self::__Unknown(value),
        }
    }
}

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

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

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