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

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

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

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

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

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

pub trait JobAttachmentsExt: IsA<JobAttachments> + 'static {
    #[doc(alias = "pps_job_attachments_get_attachments")]
    #[doc(alias = "get_attachments")]
    fn attachments(&self) -> Vec<papers_document::Attachment> {
        unsafe {
            FromGlibPtrContainer::from_glib_none(ffi::pps_job_attachments_get_attachments(
                self.as_ref().to_glib_none().0,
            ))
        }
    }
}

impl<O: IsA<JobAttachments>> JobAttachmentsExt for O {}
