//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;

use crate::*;

/// # Safety
///
/// - `media_box` must be a valid pointer or null.
/// - `auxiliary_info` generics must be of the correct type.
#[cfg(all(feature = "CGContext", feature = "CGDataConsumer"))]
#[inline]
pub unsafe extern "C-unwind" fn CGPDFContextCreate(
    consumer: Option<&CGDataConsumer>,
    media_box: *const CGRect,
    auxiliary_info: Option<&CFDictionary>,
) -> Option<CFRetained<CGContext>> {
    extern "C-unwind" {
        fn CGPDFContextCreate(
            consumer: Option<&CGDataConsumer>,
            media_box: *const CGRect,
            auxiliary_info: Option<&CFDictionary>,
        ) -> Option<NonNull<CGContext>>;
    }
    let ret = unsafe { CGPDFContextCreate(consumer, media_box, auxiliary_info) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// # Safety
///
/// - `media_box` must be a valid pointer or null.
/// - `auxiliary_info` generics must be of the correct type.
#[cfg(feature = "CGContext")]
#[inline]
pub unsafe extern "C-unwind" fn CGPDFContextCreateWithURL(
    url: Option<&CFURL>,
    media_box: *const CGRect,
    auxiliary_info: Option<&CFDictionary>,
) -> Option<CFRetained<CGContext>> {
    extern "C-unwind" {
        fn CGPDFContextCreateWithURL(
            url: Option<&CFURL>,
            media_box: *const CGRect,
            auxiliary_info: Option<&CFDictionary>,
        ) -> Option<NonNull<CGContext>>;
    }
    let ret = unsafe { CGPDFContextCreateWithURL(url, media_box, auxiliary_info) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

#[cfg(feature = "CGContext")]
#[inline]
pub extern "C-unwind" fn CGPDFContextClose(context: Option<&CGContext>) {
    extern "C-unwind" {
        fn CGPDFContextClose(context: Option<&CGContext>);
    }
    unsafe { CGPDFContextClose(context) }
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `page_info` generics must be of the correct type.
    #[cfg(feature = "CGContext")]
    pub fn CGPDFContextBeginPage(context: Option<&CGContext>, page_info: Option<&CFDictionary>);
}

#[cfg(feature = "CGContext")]
#[inline]
pub extern "C-unwind" fn CGPDFContextEndPage(context: Option<&CGContext>) {
    extern "C-unwind" {
        fn CGPDFContextEndPage(context: Option<&CGContext>);
    }
    unsafe { CGPDFContextEndPage(context) }
}

#[cfg(feature = "CGContext")]
#[inline]
pub extern "C-unwind" fn CGPDFContextAddDocumentMetadata(
    context: Option<&CGContext>,
    metadata: Option<&CFData>,
) {
    extern "C-unwind" {
        fn CGPDFContextAddDocumentMetadata(context: Option<&CGContext>, metadata: Option<&CFData>);
    }
    unsafe { CGPDFContextAddDocumentMetadata(context, metadata) }
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `parent_tree_dictionary` must be a valid pointer.
    #[cfg(all(feature = "CGContext", feature = "CGPDFDictionary"))]
    pub fn CGPDFContextSetParentTree(
        context: Option<&CGContext>,
        parent_tree_dictionary: CGPDFDictionaryRef,
    );
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `id_tree_dictionary` must be a valid pointer.
    #[cfg(all(feature = "CGContext", feature = "CGPDFDictionary"))]
    pub fn CGPDFContextSetIDTree(
        context: Option<&CGContext>,
        id_tree_dictionary: CGPDFDictionaryRef,
    );
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `page_tag_structure_tree_dictionary` generics must be of the correct type.
    #[cfg(feature = "CGContext")]
    pub fn CGPDFContextSetPageTagStructureTree(
        context: Option<&CGContext>,
        page_tag_structure_tree_dictionary: &CFDictionary,
    );
}

#[cfg(feature = "CGContext")]
#[inline]
pub extern "C-unwind" fn CGPDFContextSetURLForRect(
    context: Option<&CGContext>,
    url: &CFURL,
    rect: CGRect,
) {
    extern "C-unwind" {
        fn CGPDFContextSetURLForRect(context: Option<&CGContext>, url: &CFURL, rect: CGRect);
    }
    unsafe { CGPDFContextSetURLForRect(context, url, rect) }
}

#[cfg(feature = "CGContext")]
#[inline]
pub extern "C-unwind" fn CGPDFContextAddDestinationAtPoint(
    context: Option<&CGContext>,
    name: &CFString,
    point: CGPoint,
) {
    extern "C-unwind" {
        fn CGPDFContextAddDestinationAtPoint(
            context: Option<&CGContext>,
            name: &CFString,
            point: CGPoint,
        );
    }
    unsafe { CGPDFContextAddDestinationAtPoint(context, name, point) }
}

#[cfg(feature = "CGContext")]
#[inline]
pub extern "C-unwind" fn CGPDFContextSetDestinationForRect(
    context: Option<&CGContext>,
    name: &CFString,
    rect: CGRect,
) {
    extern "C-unwind" {
        fn CGPDFContextSetDestinationForRect(
            context: Option<&CGContext>,
            name: &CFString,
            rect: CGRect,
        );
    }
    unsafe { CGPDFContextSetDestinationForRect(context, name, rect) }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextmediabox?language=objc)
    pub static kCGPDFContextMediaBox: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextcropbox?language=objc)
    pub static kCGPDFContextCropBox: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextbleedbox?language=objc)
    pub static kCGPDFContextBleedBox: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontexttrimbox?language=objc)
    pub static kCGPDFContextTrimBox: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextartbox?language=objc)
    pub static kCGPDFContextArtBox: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontexttitle?language=objc)
    pub static kCGPDFContextTitle: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextauthor?language=objc)
    pub static kCGPDFContextAuthor: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextsubject?language=objc)
    pub static kCGPDFContextSubject: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextkeywords?language=objc)
    pub static kCGPDFContextKeywords: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextcreator?language=objc)
    pub static kCGPDFContextCreator: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextownerpassword?language=objc)
    pub static kCGPDFContextOwnerPassword: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextuserpassword?language=objc)
    pub static kCGPDFContextUserPassword: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextencryptionkeylength?language=objc)
    pub static kCGPDFContextEncryptionKeyLength: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextallowsprinting?language=objc)
    pub static kCGPDFContextAllowsPrinting: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextallowscopying?language=objc)
    pub static kCGPDFContextAllowsCopying: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextoutputintent?language=objc)
    pub static kCGPDFContextOutputIntent: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxoutputintentsubtype?language=objc)
    pub static kCGPDFXOutputIntentSubtype: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxoutputconditionidentifier?language=objc)
    pub static kCGPDFXOutputConditionIdentifier: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxoutputcondition?language=objc)
    pub static kCGPDFXOutputCondition: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxregistryname?language=objc)
    pub static kCGPDFXRegistryName: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxinfo?language=objc)
    pub static kCGPDFXInfo: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfxdestinationoutputprofile?language=objc)
    pub static kCGPDFXDestinationOutputProfile: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextoutputintents?language=objc)
    pub static kCGPDFContextOutputIntents: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextaccesspermissions?language=objc)
    pub static kCGPDFContextAccessPermissions: &'static CFString;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `outline` generics must be of the correct type.
    #[cfg(feature = "CGContext")]
    pub fn CGPDFContextSetOutline(context: &CGContext, outline: Option<&CFDictionary>);
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextcreatelinearizedpdf?language=objc)
    pub static kCGPDFContextCreateLinearizedPDF: &'static CFString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdfcontextcreatepdfa?language=objc)
    pub static kCGPDFContextCreatePDFA: &'static CFString;
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdftagtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CGPDFTagType(pub i32);
impl CGPDFTagType {
    #[doc(alias = "CGPDFTagTypeDocument")]
    pub const Document: Self = Self(100);
    #[doc(alias = "CGPDFTagTypePart")]
    pub const Part: Self = Self(101);
    #[doc(alias = "CGPDFTagTypeArt")]
    pub const Art: Self = Self(102);
    #[doc(alias = "CGPDFTagTypeSection")]
    pub const Section: Self = Self(103);
    #[doc(alias = "CGPDFTagTypeDiv")]
    pub const Div: Self = Self(104);
    #[doc(alias = "CGPDFTagTypeBlockQuote")]
    pub const BlockQuote: Self = Self(105);
    #[doc(alias = "CGPDFTagTypeCaption")]
    pub const Caption: Self = Self(106);
    #[doc(alias = "CGPDFTagTypeTOC")]
    pub const TOC: Self = Self(107);
    #[doc(alias = "CGPDFTagTypeTOCI")]
    pub const TOCI: Self = Self(108);
    #[doc(alias = "CGPDFTagTypeIndex")]
    pub const Index: Self = Self(109);
    #[doc(alias = "CGPDFTagTypeNonStructure")]
    pub const NonStructure: Self = Self(110);
    #[doc(alias = "CGPDFTagTypePrivate")]
    pub const Private: Self = Self(111);
    #[doc(alias = "CGPDFTagTypeParagraph")]
    pub const Paragraph: Self = Self(200);
    #[doc(alias = "CGPDFTagTypeHeader")]
    pub const Header: Self = Self(201);
    #[doc(alias = "CGPDFTagTypeHeader1")]
    pub const Header1: Self = Self(202);
    #[doc(alias = "CGPDFTagTypeHeader2")]
    pub const Header2: Self = Self(203);
    #[doc(alias = "CGPDFTagTypeHeader3")]
    pub const Header3: Self = Self(204);
    #[doc(alias = "CGPDFTagTypeHeader4")]
    pub const Header4: Self = Self(205);
    #[doc(alias = "CGPDFTagTypeHeader5")]
    pub const Header5: Self = Self(206);
    #[doc(alias = "CGPDFTagTypeHeader6")]
    pub const Header6: Self = Self(207);
    #[doc(alias = "CGPDFTagTypeList")]
    pub const List: Self = Self(300);
    #[doc(alias = "CGPDFTagTypeListItem")]
    pub const ListItem: Self = Self(301);
    #[doc(alias = "CGPDFTagTypeLabel")]
    pub const Label: Self = Self(302);
    #[doc(alias = "CGPDFTagTypeListBody")]
    pub const ListBody: Self = Self(303);
    #[doc(alias = "CGPDFTagTypeTable")]
    pub const Table: Self = Self(400);
    #[doc(alias = "CGPDFTagTypeTableRow")]
    pub const TableRow: Self = Self(401);
    #[doc(alias = "CGPDFTagTypeTableHeaderCell")]
    pub const TableHeaderCell: Self = Self(402);
    #[doc(alias = "CGPDFTagTypeTableDataCell")]
    pub const TableDataCell: Self = Self(403);
    #[doc(alias = "CGPDFTagTypeTableHeader")]
    pub const TableHeader: Self = Self(404);
    #[doc(alias = "CGPDFTagTypeTableBody")]
    pub const TableBody: Self = Self(405);
    #[doc(alias = "CGPDFTagTypeTableFooter")]
    pub const TableFooter: Self = Self(406);
    #[doc(alias = "CGPDFTagTypeSpan")]
    pub const Span: Self = Self(500);
    #[doc(alias = "CGPDFTagTypeQuote")]
    pub const Quote: Self = Self(501);
    #[doc(alias = "CGPDFTagTypeNote")]
    pub const Note: Self = Self(502);
    #[doc(alias = "CGPDFTagTypeReference")]
    pub const Reference: Self = Self(503);
    #[doc(alias = "CGPDFTagTypeBibliography")]
    pub const Bibliography: Self = Self(504);
    #[doc(alias = "CGPDFTagTypeCode")]
    pub const Code: Self = Self(505);
    #[doc(alias = "CGPDFTagTypeLink")]
    pub const Link: Self = Self(506);
    #[doc(alias = "CGPDFTagTypeAnnotation")]
    pub const Annotation: Self = Self(507);
    #[doc(alias = "CGPDFTagTypeRuby")]
    pub const Ruby: Self = Self(600);
    #[doc(alias = "CGPDFTagTypeRubyBaseText")]
    pub const RubyBaseText: Self = Self(601);
    #[doc(alias = "CGPDFTagTypeRubyAnnotationText")]
    pub const RubyAnnotationText: Self = Self(602);
    #[doc(alias = "CGPDFTagTypeRubyPunctuation")]
    pub const RubyPunctuation: Self = Self(603);
    #[doc(alias = "CGPDFTagTypeWarichu")]
    pub const Warichu: Self = Self(604);
    #[doc(alias = "CGPDFTagTypeWarichuText")]
    pub const WarichuText: Self = Self(605);
    #[doc(alias = "CGPDFTagTypeWarichuPunctiation")]
    pub const WarichuPunctiation: Self = Self(606);
    #[doc(alias = "CGPDFTagTypeFigure")]
    pub const Figure: Self = Self(700);
    #[doc(alias = "CGPDFTagTypeFormula")]
    pub const Formula: Self = Self(701);
    #[doc(alias = "CGPDFTagTypeForm")]
    pub const Form: Self = Self(702);
    #[doc(alias = "CGPDFTagTypeObject")]
    pub const Object: Self = Self(800);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for CGPDFTagType {
    const ENCODING: Encoding = i32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for CGPDFTagType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

impl CGPDFTagType {
    #[doc(alias = "CGPDFTagTypeGetName")]
    #[inline]
    pub fn name(self) -> *const c_char {
        extern "C-unwind" {
            fn CGPDFTagTypeGetName(tag_type: CGPDFTagType) -> *const c_char;
        }
        unsafe { CGPDFTagTypeGetName(self) }
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/cgpdftagproperty?language=objc)
// NS_TYPED_ENUM
pub type CGPDFTagProperty = CFString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdftagpropertyactualtext?language=objc)
    pub static kCGPDFTagPropertyActualText: &'static CGPDFTagProperty;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdftagpropertyalternativetext?language=objc)
    pub static kCGPDFTagPropertyAlternativeText: &'static CGPDFTagProperty;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdftagpropertytitletext?language=objc)
    pub static kCGPDFTagPropertyTitleText: &'static CGPDFTagProperty;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/coregraphics/kcgpdftagpropertylanguagetext?language=objc)
    pub static kCGPDFTagPropertyLanguageText: &'static CGPDFTagProperty;
}

extern "C-unwind" {
    /// # Safety
    ///
    /// `tag_properties` generics must be of the correct type.
    #[cfg(feature = "CGContext")]
    pub fn CGPDFContextBeginTag(
        context: &CGContext,
        tag_type: CGPDFTagType,
        tag_properties: Option<&CFDictionary>,
    );
}

#[cfg(feature = "CGContext")]
#[inline]
pub extern "C-unwind" fn CGPDFContextEndTag(context: &CGContext) {
    extern "C-unwind" {
        fn CGPDFContextEndTag(context: &CGContext);
    }
    unsafe { CGPDFContextEndTag(context) }
}

#[deprecated = "renamed to `CGPDFTagType::name`"]
#[inline]
pub extern "C-unwind" fn CGPDFTagTypeGetName(tag_type: CGPDFTagType) -> *const c_char {
    extern "C-unwind" {
        fn CGPDFTagTypeGetName(tag_type: CGPDFTagType) -> *const c_char;
    }
    unsafe { CGPDFTagTypeGetName(tag_type) }
}
