//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidocumentinteractioncontroller?language=objc)
    #[unsafe(super(NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIDocumentInteractionController;
);

extern_conformance!(
    unsafe impl NSObjectProtocol for UIDocumentInteractionController {}
);

#[cfg(feature = "UIActionSheet")]
extern_conformance!(
    unsafe impl UIActionSheetDelegate for UIDocumentInteractionController {}
);

impl UIDocumentInteractionController {
    extern_methods!(
        #[unsafe(method(interactionControllerWithURL:))]
        #[unsafe(method_family = none)]
        pub fn interactionControllerWithURL(
            url: &NSURL,
            mtm: MainThreadMarker,
        ) -> Retained<UIDocumentInteractionController>;

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UIDocumentInteractionControllerDelegate>>>;

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

        #[unsafe(method(URL))]
        #[unsafe(method_family = none)]
        pub fn URL(&self) -> Option<Retained<NSURL>>;

        /// Setter for [`URL`][Self::URL].
        #[unsafe(method(setURL:))]
        #[unsafe(method_family = none)]
        pub fn setURL(&self, url: Option<&NSURL>);

        #[unsafe(method(UTI))]
        #[unsafe(method_family = none)]
        pub fn UTI(&self) -> Option<Retained<NSString>>;

        /// Setter for [`UTI`][Self::UTI].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setUTI:))]
        #[unsafe(method_family = none)]
        pub fn setUTI(&self, uti: Option<&NSString>);

        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub fn name(&self) -> Option<Retained<NSString>>;

        /// Setter for [`name`][Self::name].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setName:))]
        #[unsafe(method_family = none)]
        pub fn setName(&self, name: Option<&NSString>);

        #[cfg(feature = "UIImage")]
        #[unsafe(method(icons))]
        #[unsafe(method_family = none)]
        pub fn icons(&self) -> Retained<NSArray<UIImage>>;

        #[unsafe(method(annotation))]
        #[unsafe(method_family = none)]
        pub fn annotation(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`annotation`][Self::annotation].
        ///
        /// # Safety
        ///
        /// `annotation` should be of the correct type.
        #[unsafe(method(setAnnotation:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAnnotation(&self, annotation: Option<&AnyObject>);

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(presentOptionsMenuFromRect:inView:animated:))]
        #[unsafe(method_family = none)]
        pub fn presentOptionsMenuFromRect_inView_animated(
            &self,
            rect: CGRect,
            view: &UIView,
            animated: bool,
        ) -> bool;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[unsafe(method(presentOptionsMenuFromBarButtonItem:animated:))]
        #[unsafe(method_family = none)]
        pub fn presentOptionsMenuFromBarButtonItem_animated(
            &self,
            item: &UIBarButtonItem,
            animated: bool,
        ) -> bool;

        #[unsafe(method(presentPreviewAnimated:))]
        #[unsafe(method_family = none)]
        pub fn presentPreviewAnimated(&self, animated: bool) -> bool;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(presentOpenInMenuFromRect:inView:animated:))]
        #[unsafe(method_family = none)]
        pub fn presentOpenInMenuFromRect_inView_animated(
            &self,
            rect: CGRect,
            view: &UIView,
            animated: bool,
        ) -> bool;

        #[cfg(all(feature = "UIBarButtonItem", feature = "UIBarItem"))]
        #[unsafe(method(presentOpenInMenuFromBarButtonItem:animated:))]
        #[unsafe(method_family = none)]
        pub fn presentOpenInMenuFromBarButtonItem_animated(
            &self,
            item: &UIBarButtonItem,
            animated: bool,
        ) -> bool;

        #[unsafe(method(dismissPreviewAnimated:))]
        #[unsafe(method_family = none)]
        pub fn dismissPreviewAnimated(&self, animated: bool);

        #[unsafe(method(dismissMenuAnimated:))]
        #[unsafe(method_family = none)]
        pub fn dismissMenuAnimated(&self, animated: bool);

        #[cfg(feature = "UIGestureRecognizer")]
        #[unsafe(method(gestureRecognizers))]
        #[unsafe(method_family = none)]
        pub fn gestureRecognizers(&self) -> Retained<NSArray<UIGestureRecognizer>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl UIDocumentInteractionController {
    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>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uidocumentinteractioncontrollerdelegate?language=objc)
    pub unsafe trait UIDocumentInteractionControllerDelegate: NSObjectProtocol {
        #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
        #[optional]
        #[unsafe(method(documentInteractionControllerViewControllerForPreview:))]
        #[unsafe(method_family = none)]
        fn documentInteractionControllerViewControllerForPreview(
            &self,
            controller: &UIDocumentInteractionController,
        ) -> Retained<UIViewController>;

        #[cfg(feature = "objc2-core-foundation")]
        #[optional]
        #[unsafe(method(documentInteractionControllerRectForPreview:))]
        #[unsafe(method_family = none)]
        fn documentInteractionControllerRectForPreview(
            &self,
            controller: &UIDocumentInteractionController,
        ) -> CGRect;

        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        #[optional]
        #[unsafe(method(documentInteractionControllerViewForPreview:))]
        #[unsafe(method_family = none)]
        fn documentInteractionControllerViewForPreview(
            &self,
            controller: &UIDocumentInteractionController,
        ) -> Option<Retained<UIView>>;

        #[optional]
        #[unsafe(method(documentInteractionControllerWillBeginPreview:))]
        #[unsafe(method_family = none)]
        fn documentInteractionControllerWillBeginPreview(
            &self,
            controller: &UIDocumentInteractionController,
        );

        #[optional]
        #[unsafe(method(documentInteractionControllerDidEndPreview:))]
        #[unsafe(method_family = none)]
        fn documentInteractionControllerDidEndPreview(
            &self,
            controller: &UIDocumentInteractionController,
        );

        #[optional]
        #[unsafe(method(documentInteractionControllerWillPresentOptionsMenu:))]
        #[unsafe(method_family = none)]
        fn documentInteractionControllerWillPresentOptionsMenu(
            &self,
            controller: &UIDocumentInteractionController,
        );

        #[optional]
        #[unsafe(method(documentInteractionControllerDidDismissOptionsMenu:))]
        #[unsafe(method_family = none)]
        fn documentInteractionControllerDidDismissOptionsMenu(
            &self,
            controller: &UIDocumentInteractionController,
        );

        #[optional]
        #[unsafe(method(documentInteractionControllerWillPresentOpenInMenu:))]
        #[unsafe(method_family = none)]
        fn documentInteractionControllerWillPresentOpenInMenu(
            &self,
            controller: &UIDocumentInteractionController,
        );

        #[optional]
        #[unsafe(method(documentInteractionControllerDidDismissOpenInMenu:))]
        #[unsafe(method_family = none)]
        fn documentInteractionControllerDidDismissOpenInMenu(
            &self,
            controller: &UIDocumentInteractionController,
        );

        #[optional]
        #[unsafe(method(documentInteractionController:willBeginSendingToApplication:))]
        #[unsafe(method_family = none)]
        fn documentInteractionController_willBeginSendingToApplication(
            &self,
            controller: &UIDocumentInteractionController,
            application: Option<&NSString>,
        );

        #[optional]
        #[unsafe(method(documentInteractionController:didEndSendingToApplication:))]
        #[unsafe(method_family = none)]
        fn documentInteractionController_didEndSendingToApplication(
            &self,
            controller: &UIDocumentInteractionController,
            application: Option<&NSString>,
        );

        /// # Safety
        ///
        /// `action` must be a valid selector.
        #[deprecated]
        #[optional]
        #[unsafe(method(documentInteractionController:canPerformAction:))]
        #[unsafe(method_family = none)]
        unsafe fn documentInteractionController_canPerformAction(
            &self,
            controller: &UIDocumentInteractionController,
            action: Option<Sel>,
        ) -> bool;

        /// # Safety
        ///
        /// `action` must be a valid selector.
        #[deprecated]
        #[optional]
        #[unsafe(method(documentInteractionController:performAction:))]
        #[unsafe(method_family = none)]
        unsafe fn documentInteractionController_performAction(
            &self,
            controller: &UIDocumentInteractionController,
            action: Option<Sel>,
        ) -> bool;
    }
);
