//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidocumentviewcontroller?language=objc)
    #[unsafe(super(UIViewController, UIResponder, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    pub struct UIDocumentViewController;
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl NSCoding for UIDocumentViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIDocumentViewController {}
);

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIResponder",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UIDocumentViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl UIContentContainer for UIDocumentViewController {}
);

#[cfg(all(
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UIDocumentViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UIDocumentViewController {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UIDocumentViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIDocumentViewController {
    extern_methods!(
        #[cfg(feature = "UIDocument")]
        #[unsafe(method(initWithDocument:))]
        #[unsafe(method_family = init)]
        pub fn initWithDocument(
            this: Allocated<Self>,
            document: Option<&UIDocument>,
        ) -> Retained<Self>;

        #[cfg(feature = "UIDocument")]
        #[unsafe(method(document))]
        #[unsafe(method_family = none)]
        pub fn document(&self) -> Option<Retained<UIDocument>>;

        #[cfg(feature = "UIDocument")]
        /// Setter for [`document`][Self::document].
        #[unsafe(method(setDocument:))]
        #[unsafe(method_family = none)]
        pub fn setDocument(&self, document: Option<&UIDocument>);

        #[cfg(feature = "UIDocumentViewControllerLaunchOptions")]
        /// Properties to configure the view controller when no document is open.
        #[unsafe(method(launchOptions))]
        #[unsafe(method_family = none)]
        pub fn launchOptions(&self) -> Retained<UIDocumentViewControllerLaunchOptions>;

        #[cfg(feature = "UIDocumentViewControllerLaunchOptions")]
        /// Setter for [`launchOptions`][Self::launchOptions].
        #[unsafe(method(setLaunchOptions:))]
        #[unsafe(method_family = none)]
        pub fn setLaunchOptions(&self, launch_options: &UIDocumentViewControllerLaunchOptions);

        /// When this view controller updates its navigation item, this method will be called, allowing subclasses to apply any kind of customization you might want.
        #[unsafe(method(navigationItemDidUpdate))]
        #[unsafe(method_family = none)]
        pub fn navigationItemDidUpdate(&self);

        #[cfg(feature = "block2")]
        /// Opens the current document.
        /// This method is optional. If the document is not opened by the time the view controller becomes visible, the view controller will take care of opening the document.
        /// If the document is already opened, the completion handler will be called as if opening the document succeeded.
        #[unsafe(method(openDocumentWithCompletionHandler:))]
        #[unsafe(method_family = none)]
        pub fn openDocumentWithCompletionHandler(
            &self,
            completion_handler: &block2::DynBlock<dyn Fn(Bool)>,
        );

        /// Notifies subclasses that the specified document was opened. This method will be called by the system after
        /// opening the document initially or after the presented document was changed.
        #[unsafe(method(documentDidOpen))]
        #[unsafe(method_family = none)]
        pub fn documentDidOpen(&self);

        #[cfg(feature = "UIBarButtonItemGroup")]
        /// MARK: Custom Navigation Items
        #[unsafe(method(undoRedoItemGroup))]
        #[unsafe(method_family = none)]
        pub fn undoRedoItemGroup(&self) -> Retained<UIBarButtonItemGroup>;
    );
}

/// Methods declared on superclass `UIViewController`.
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIDocumentViewController {
    extern_methods!(
        #[unsafe(method(initWithNibName:bundle:))]
        #[unsafe(method_family = init)]
        pub fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSString>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIDocumentViewController {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}
