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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uibandselectioninteractionstate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIBandSelectionInteractionState(pub NSInteger);
impl UIBandSelectionInteractionState {
    #[doc(alias = "UIBandSelectionInteractionStatePossible")]
    pub const Possible: Self = Self(0);
    #[doc(alias = "UIBandSelectionInteractionStateBegan")]
    pub const Began: Self = Self(1);
    #[doc(alias = "UIBandSelectionInteractionStateSelecting")]
    pub const Selecting: Self = Self(2);
    #[doc(alias = "UIBandSelectionInteractionStateEnded")]
    pub const Ended: Self = Self(3);
}

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

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

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

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

#[cfg(feature = "UIInteraction")]
extern_conformance!(
    unsafe impl UIInteraction for UIBandSelectionInteraction {}
);

impl UIBandSelectionInteraction {
    extern_methods!(
        /// Indicates whether the interaction is enabled. Defaults to YES.
        #[unsafe(method(isEnabled))]
        #[unsafe(method_family = none)]
        pub fn isEnabled(&self) -> bool;

        /// Setter for [`isEnabled`][Self::isEnabled].
        #[unsafe(method(setEnabled:))]
        #[unsafe(method_family = none)]
        pub fn setEnabled(&self, enabled: bool);

        /// The interaction's current state.
        #[unsafe(method(state))]
        #[unsafe(method_family = none)]
        pub fn state(&self) -> UIBandSelectionInteractionState;

        #[cfg(feature = "objc2-core-foundation")]
        /// The current selection rect. Returns CGRectNull when the interaction is inactive.
        #[unsafe(method(selectionRect))]
        #[unsafe(method_family = none)]
        pub fn selectionRect(&self) -> CGRect;

        #[cfg(feature = "UICommand")]
        /// Modifier keys held at the beginning of the interaction.
        #[unsafe(method(initialModifierFlags))]
        #[unsafe(method_family = none)]
        pub fn initialModifierFlags(&self) -> UIKeyModifierFlags;

        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        /// Called when the interaction is about to begin.
        /// Return a boolean indicating whether the interaction should begin at the given location.
        ///
        /// # Safety
        ///
        /// The returned block's argument 1 must be a valid pointer.
        #[unsafe(method(shouldBeginHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn shouldBeginHandler(
            &self,
        ) -> *mut block2::DynBlock<dyn Fn(NonNull<UIBandSelectionInteraction>, CGPoint) -> Bool>;

        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        /// Setter for [`shouldBeginHandler`][Self::shouldBeginHandler].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setShouldBeginHandler:))]
        #[unsafe(method_family = none)]
        pub fn setShouldBeginHandler(
            &self,
            should_begin_handler: Option<
                &block2::DynBlock<dyn Fn(NonNull<UIBandSelectionInteraction>, CGPoint) -> Bool>,
            >,
        );

        #[cfg(feature = "block2")]
        /// Creates a UIBandSelectionInteraction with the given selection handler.
        ///
        ///
        /// Parameter `selectionHandler`: Called when the interaction's state and/or selection rect change.
        #[unsafe(method(initWithSelectionHandler:))]
        #[unsafe(method_family = init)]
        pub fn initWithSelectionHandler(
            this: Allocated<Self>,
            selection_handler: &block2::DynBlock<dyn Fn(NonNull<UIBandSelectionInteraction>)>,
        ) -> Retained<Self>;

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