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

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

glib::wrapper! {
    #[doc(alias = "PpsJobLayers")]
    pub struct JobLayers(Object<ffi::PpsJobLayers, ffi::PpsJobLayersClass>) @extends Job;

    match fn {
        type_ => || ffi::pps_job_layers_get_type(),
    }
}

impl JobLayers {
    pub const NONE: Option<&'static JobLayers> = None;

    #[doc(alias = "pps_job_layers_new")]
    pub fn new(document: &impl IsA<papers_document::Document>) -> JobLayers {
        assert_initialized_main_thread!();
        unsafe {
            Job::from_glib_full(ffi::pps_job_layers_new(document.as_ref().to_glib_none().0))
                .unsafe_cast()
        }
    }
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::JobLayers>> Sealed for T {}
}

pub trait JobLayersExt: IsA<JobLayers> + sealed::Sealed + 'static {
    #[doc(alias = "pps_job_layers_get_model")]
    #[doc(alias = "get_model")]
    fn model(&self) -> Option<gio::ListModel> {
        unsafe {
            from_glib_full(ffi::pps_job_layers_get_model(
                self.as_ref().to_glib_none().0,
            ))
        }
    }
}

impl<O: IsA<JobLayers>> JobLayersExt for O {}
