//! 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidocumentmenuorder?language=objc)
// NS_ENUM
#[deprecated]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIDocumentMenuOrder(pub NSUInteger);
impl UIDocumentMenuOrder {
    #[doc(alias = "UIDocumentMenuOrderFirst")]
    #[deprecated]
    pub const First: Self = Self(0);
    #[doc(alias = "UIDocumentMenuOrderLast")]
    #[deprecated]
    pub const Last: Self = Self(1);
}

unsafe impl Encode for UIDocumentMenuOrder {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for UIDocumentMenuOrder {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidocumentmenudelegate?language=objc)
    #[deprecated = "UIDocumentMenuDelegate is deprecated. Use UIDocumentPickerViewController directly."]
    pub unsafe trait UIDocumentMenuDelegate: NSObjectProtocol + MainThreadOnly {
        #[cfg(all(
            feature = "UIDocumentPickerViewController",
            feature = "UIResponder",
            feature = "UIViewController"
        ))]
        #[deprecated = "UIDocumentMenuDelegate is deprecated. Use UIDocumentPickerViewController directly."]
        #[unsafe(method(documentMenu:didPickDocumentPicker:))]
        #[unsafe(method_family = none)]
        fn documentMenu_didPickDocumentPicker(
            &self,
            document_menu: &UIDocumentMenuViewController,
            document_picker: &UIDocumentPickerViewController,
        );

        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[deprecated = "UIDocumentMenuDelegate is deprecated. Use UIDocumentPickerViewController directly."]
        #[optional]
        #[unsafe(method(documentMenuWasCancelled:))]
        #[unsafe(method_family = none)]
        fn documentMenuWasCancelled(&self, document_menu: &UIDocumentMenuViewController);
    }
);

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidocumentmenuviewcontroller?language=objc)
    #[unsafe(super(UIViewController, UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    #[deprecated = "UIDocumentMenuViewController is deprecated. Use UIDocumentPickerViewController directly."]
    pub struct UIDocumentMenuViewController;
);

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

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

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

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

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

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

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

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIDocumentMenuViewController {
    extern_methods!(
        #[cfg(feature = "UIDocumentPickerViewController")]
        #[deprecated = "UIDocumentMenuViewController is deprecated. Use UIDocumentPickerViewController directly."]
        #[unsafe(method(initWithDocumentTypes:inMode:))]
        #[unsafe(method_family = init)]
        pub fn initWithDocumentTypes_inMode(
            this: Allocated<Self>,
            allowed_ut_is: &NSArray<NSString>,
            mode: UIDocumentPickerMode,
        ) -> Retained<Self>;

        #[cfg(feature = "UIDocumentPickerViewController")]
        #[deprecated = "UIDocumentMenuViewController is deprecated. Use UIDocumentPickerViewController directly."]
        #[unsafe(method(initWithURL:inMode:))]
        #[unsafe(method_family = init)]
        pub fn initWithURL_inMode(
            this: Allocated<Self>,
            url: &NSURL,
            mode: UIDocumentPickerMode,
        ) -> Retained<Self>;

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

        #[cfg(all(feature = "UIImage", feature = "block2"))]
        #[deprecated = "UIDocumentMenuViewController is deprecated. Use UIDocumentPickerViewController directly."]
        #[unsafe(method(addOptionWithTitle:image:order:handler:))]
        #[unsafe(method_family = none)]
        pub fn addOptionWithTitle_image_order_handler(
            &self,
            title: &NSString,
            image: Option<&UIImage>,
            order: UIDocumentMenuOrder,
            handler: &block2::DynBlock<dyn Fn()>,
        );

        #[deprecated = "UIDocumentMenuViewController is deprecated. Use UIDocumentPickerViewController directly."]
        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn UIDocumentMenuDelegate>>>;

        /// Setter for [`delegate`][Self::delegate].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[deprecated = "UIDocumentMenuViewController is deprecated. Use UIDocumentPickerViewController directly."]
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn UIDocumentMenuDelegate>>);
    );
}

/// Methods declared on superclass `UIViewController`.
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIDocumentMenuViewController {
    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>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIDocumentMenuViewController {
    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>;
    );
}
