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

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

glib::wrapper! {
    #[doc(alias = "PpsCertificateInfo")]
    pub struct CertificateInfo(Object<ffi::PpsCertificateInfo, ffi::PpsCertificateInfoClass>);

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

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

    #[doc(alias = "pps_certificate_info_new")]
    pub fn new(id: &str, subject_common_name: &str) -> CertificateInfo {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::pps_certificate_info_new(
                id.to_glib_none().0,
                subject_common_name.to_glib_none().0,
            ))
        }
    }
}

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

pub trait CertificateInfoExt: IsA<CertificateInfo> + sealed::Sealed + 'static {
    #[doc(alias = "expiration-time")]
    fn expiration_time(&self) -> Option<glib::DateTime> {
        ObjectExt::property(self.as_ref(), "expiration-time")
    }

    fn id(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "id")
    }

    #[doc(alias = "issuance-time")]
    fn issuance_time(&self) -> Option<glib::DateTime> {
        ObjectExt::property(self.as_ref(), "issuance-time")
    }

    #[doc(alias = "issuer-common-name")]
    fn issuer_common_name(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "issuer-common-name")
    }

    #[doc(alias = "issuer-email")]
    fn issuer_email(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "issuer-email")
    }

    #[doc(alias = "issuer-organization")]
    fn issuer_organization(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "issuer-organization")
    }

    fn status(&self) -> CertificateStatus {
        ObjectExt::property(self.as_ref(), "status")
    }

    #[doc(alias = "subject-common-name")]
    fn subject_common_name(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "subject-common-name")
    }

    #[doc(alias = "subject-email")]
    fn subject_email(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "subject-email")
    }

    #[doc(alias = "subject-organization")]
    fn subject_organization(&self) -> Option<glib::GString> {
        ObjectExt::property(self.as_ref(), "subject-organization")
    }
}

impl<O: IsA<CertificateInfo>> CertificateInfoExt for O {}
