// 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 = "PpsJobSignatures")]
    pub struct JobSignatures(Object<ffi::PpsJobSignatures, ffi::PpsJobSignaturesClass>) @extends Job;

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

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

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

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

pub trait JobSignaturesExt: IsA<JobSignatures> + sealed::Sealed + 'static {
    #[doc(alias = "pps_job_signatures_get_signatures")]
    #[doc(alias = "get_signatures")]
    fn signatures(&self) -> Vec<papers_document::Signature> {
        unsafe {
            FromGlibPtrContainer::from_glib_none(ffi::pps_job_signatures_get_signatures(
                self.as_ref().to_glib_none().0,
            ))
        }
    }
}

impl<O: IsA<JobSignatures>> JobSignaturesExt for O {}
