//! 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/uidocumentbrowseractionavailability?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIDocumentBrowserActionAvailability(pub NSInteger);
bitflags::bitflags! {
    impl UIDocumentBrowserActionAvailability: NSInteger {
        #[doc(alias = "UIDocumentBrowserActionAvailabilityMenu")]
        const Menu = 1;
        #[doc(alias = "UIDocumentBrowserActionAvailabilityNavigationBar")]
        const NavigationBar = 1<<1;
    }
}

unsafe impl Encode for UIDocumentBrowserActionAvailability {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

extern_class!(
    /// UIDocumentBrowserAction instances are custom, contextual actions that are presented to the user by a UIDocumentBrowserViewController.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uidocumentbrowseraction?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UIDocumentBrowserAction;
);

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

impl UIDocumentBrowserAction {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "block2")]
        #[unsafe(method(initWithIdentifier:localizedTitle:availability:handler:))]
        #[unsafe(method_family = init)]
        pub fn initWithIdentifier_localizedTitle_availability_handler(
            this: Allocated<Self>,
            identifier: &NSString,
            localized_title: &NSString,
            availability: UIDocumentBrowserActionAvailability,
            handler: &block2::DynBlock<dyn Fn(NonNull<NSArray<NSURL>>)>,
        ) -> Retained<Self>;

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

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

        #[unsafe(method(availability))]
        #[unsafe(method_family = none)]
        pub fn availability(&self) -> UIDocumentBrowserActionAvailability;

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

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

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

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

        /// Allows clients to restrict the action to only a specific set of content types. Default: [UTTypeItem.identifier]
        #[unsafe(method(supportedContentTypes))]
        #[unsafe(method_family = none)]
        pub fn supportedContentTypes(&self) -> Retained<NSArray<NSString>>;

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

        /// If NO, the action is only available, if there is only one item selected. Default: YES.
        #[unsafe(method(supportsMultipleItems))]
        #[unsafe(method_family = none)]
        pub fn supportsMultipleItems(&self) -> bool;

        /// Setter for [`supportsMultipleItems`][Self::supportsMultipleItems].
        #[unsafe(method(setSupportsMultipleItems:))]
        #[unsafe(method_family = none)]
        pub fn setSupportsMultipleItems(&self, supports_multiple_items: bool);
    );
}

/// Methods declared on superclass `NSObject`.
impl UIDocumentBrowserAction {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}
