//! 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/uiaccessibilitycustomactionhandler?language=objc)
#[cfg(feature = "block2")]
pub type UIAccessibilityCustomActionHandler =
    *mut block2::DynBlock<dyn Fn(NonNull<UIAccessibilityCustomAction>) -> Bool>;

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

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

impl UIAccessibilityCustomAction {
    extern_methods!(
        /// # Safety
        ///
        /// - `target` should be of the correct type.
        /// - `selector` must be a valid selector.
        #[unsafe(method(initWithName:target:selector:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithName_target_selector(
            this: Allocated<Self>,
            name: &NSString,
            target: Option<&AnyObject>,
            selector: Sel,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// - `target` should be of the correct type.
        /// - `selector` must be a valid selector.
        #[unsafe(method(initWithAttributedName:target:selector:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAttributedName_target_selector(
            this: Allocated<Self>,
            attributed_name: &NSAttributedString,
            target: Option<&AnyObject>,
            selector: Sel,
        ) -> Retained<Self>;

        #[cfg(feature = "UIImage")]
        /// # Safety
        ///
        /// - `target` should be of the correct type.
        /// - `selector` must be a valid selector.
        #[unsafe(method(initWithName:image:target:selector:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithName_image_target_selector(
            this: Allocated<Self>,
            name: &NSString,
            image: Option<&UIImage>,
            target: Option<&AnyObject>,
            selector: Sel,
        ) -> Retained<Self>;

        #[cfg(feature = "UIImage")]
        /// # Safety
        ///
        /// - `target` should be of the correct type.
        /// - `selector` must be a valid selector.
        #[unsafe(method(initWithAttributedName:image:target:selector:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAttributedName_image_target_selector(
            this: Allocated<Self>,
            attributed_name: &NSAttributedString,
            image: Option<&UIImage>,
            target: Option<&AnyObject>,
            selector: Sel,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `action_handler` must be a valid pointer.
        #[unsafe(method(initWithName:actionHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithName_actionHandler(
            this: Allocated<Self>,
            name: &NSString,
            action_handler: UIAccessibilityCustomActionHandler,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `action_handler` must be a valid pointer.
        #[unsafe(method(initWithAttributedName:actionHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAttributedName_actionHandler(
            this: Allocated<Self>,
            attributed_name: &NSAttributedString,
            action_handler: UIAccessibilityCustomActionHandler,
        ) -> Retained<Self>;

        #[cfg(all(feature = "UIImage", feature = "block2"))]
        /// # Safety
        ///
        /// `action_handler` must be a valid pointer.
        #[unsafe(method(initWithName:image:actionHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithName_image_actionHandler(
            this: Allocated<Self>,
            name: &NSString,
            image: Option<&UIImage>,
            action_handler: UIAccessibilityCustomActionHandler,
        ) -> Retained<Self>;

        #[cfg(all(feature = "UIImage", feature = "block2"))]
        /// # Safety
        ///
        /// `action_handler` must be a valid pointer.
        #[unsafe(method(initWithAttributedName:image:actionHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithAttributedName_image_actionHandler(
            this: Allocated<Self>,
            attributed_name: &NSAttributedString,
            image: Option<&UIImage>,
            action_handler: UIAccessibilityCustomActionHandler,
        ) -> Retained<Self>;

        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub fn name(&self) -> 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: &NSString);

        #[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>);

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

        /// Setter for [`attributedName`][Self::attributedName].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAttributedName:))]
        #[unsafe(method_family = none)]
        pub fn setAttributedName(&self, attributed_name: &NSAttributedString);

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

        /// Setter for [`target`][Self::target].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        ///
        /// # Safety
        ///
        /// `target` should be of the correct type.
        #[unsafe(method(setTarget:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);

        /// # Safety
        ///
        /// You must ensure this is still alive.
        #[unsafe(method(selector))]
        #[unsafe(method_family = none)]
        pub unsafe fn selector(&self) -> Sel;

        /// Setter for [`selector`][Self::selector].
        ///
        /// # Safety
        ///
        /// - `selector` must be a valid selector.
        /// - This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setSelector:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSelector(&self, selector: Sel);

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// The returned block's argument must be a valid pointer.
        #[unsafe(method(actionHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn actionHandler(&self) -> UIAccessibilityCustomActionHandler;

        #[cfg(feature = "block2")]
        /// Setter for [`actionHandler`][Self::actionHandler].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `action_handler` must be a valid pointer or null.
        #[unsafe(method(setActionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setActionHandler(&self, action_handler: UIAccessibilityCustomActionHandler);

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

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

/// Methods declared on superclass `NSObject`.
impl UIAccessibilityCustomAction {
    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 "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiaccessibilitycustomactioncategoryedit?language=objc)
    pub static UIAccessibilityCustomActionCategoryEdit: &'static NSString;
}
