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

/// Return a
/// `UIWindowSceneActivationConfiguration`
///
/// Parameter `action`: The
/// `UIWindowSceneActivationAction`requesting a configuration.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowsceneactivationactionconfigurationprovider?language=objc)
#[cfg(all(
    feature = "UIAction",
    feature = "UIMenuElement",
    feature = "UIWindowSceneActivationConfiguration",
    feature = "block2"
))]
pub type UIWindowSceneActivationActionConfigurationProvider = *mut block2::DynBlock<
    dyn Fn(NonNull<UIWindowSceneActivationAction>) -> *mut UIWindowSceneActivationConfiguration,
>;

extern_class!(
    /// An action that facilitates activating a
    /// `UIWindowScene`when performed.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiwindowsceneactivationaction?language=objc)
    #[unsafe(super(UIAction, UIMenuElement, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
    pub struct UIWindowSceneActivationAction;
);

#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
extern_conformance!(
    unsafe impl NSCoding for UIWindowSceneActivationAction {}
);

#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
extern_conformance!(
    unsafe impl NSCopying for UIWindowSceneActivationAction {}
);

#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
unsafe impl CopyingHelper for UIWindowSceneActivationAction {
    type Result = Self;
}

#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIWindowSceneActivationAction {}
);

#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
extern_conformance!(
    unsafe impl NSSecureCoding for UIWindowSceneActivationAction {}
);

#[cfg(all(
    feature = "UIAction",
    feature = "UIMenuElement",
    feature = "UIMenuLeaf"
))]
extern_conformance!(
    unsafe impl UIMenuLeaf for UIWindowSceneActivationAction {}
);

#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
impl UIWindowSceneActivationAction {
    extern_methods!(
        /// The actions title. Set to nil to use the default title.
        #[unsafe(method(title))]
        #[unsafe(method_family = none)]
        pub fn title(&self) -> Retained<NSString>;

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

        #[cfg(all(feature = "UIWindowSceneActivationConfiguration", feature = "block2"))]
        /// Returns a new
        /// `UIWindowSceneActivationAction`
        ///
        /// Parameter `identifier`: The action's identifier. Pass nil to use an auto-generated identifier.
        ///
        /// Parameter `alternateAction`: If running on a platform that doesn't support multiple windows, the alternate action is used. Otherwise, the alternates handler is called if the scene activation request fails.
        ///
        /// Parameter `configurationProvider`: Called when the action has been triggered. It should return a
        /// `UIWindowSceneActivationConfiguration`whose user activity will be used to request scene activation.
        ///
        /// # Safety
        ///
        /// `configuration_provider` must be a valid pointer.
        #[unsafe(method(actionWithIdentifier:alternateAction:configurationProvider:))]
        #[unsafe(method_family = none)]
        pub unsafe fn actionWithIdentifier_alternateAction_configurationProvider(
            identifier: Option<&UIActionIdentifier>,
            alternate_action: Option<&UIAction>,
            configuration_provider: UIWindowSceneActivationActionConfigurationProvider,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `handler` must be a valid pointer.
        #[unsafe(method(actionWithHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn actionWithHandler(
            handler: UIActionHandler,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;

        #[cfg(all(feature = "UIImage", feature = "block2"))]
        /// # Safety
        ///
        /// `handler` must be a valid pointer.
        #[unsafe(method(actionWithTitle:image:identifier:handler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn actionWithTitle_image_identifier_handler(
            title: &NSString,
            image: Option<&UIImage>,
            identifier: Option<&UIActionIdentifier>,
            handler: UIActionHandler,
            mtm: MainThreadMarker,
        ) -> Retained<Self>;
    );
}

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

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

/// Methods declared on superclass `UIMenuElement`.
#[cfg(all(feature = "UIAction", feature = "UIMenuElement"))]
impl UIWindowSceneActivationAction {
    extern_methods!(
        /// # 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>>;
    );
}
