//! 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/uiswipegesturerecognizerdirection?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UISwipeGestureRecognizerDirection(pub NSUInteger);
bitflags::bitflags! {
    impl UISwipeGestureRecognizerDirection: NSUInteger {
        #[doc(alias = "UISwipeGestureRecognizerDirectionRight")]
        const Right = 1<<0;
        #[doc(alias = "UISwipeGestureRecognizerDirectionLeft")]
        const Left = 1<<1;
        #[doc(alias = "UISwipeGestureRecognizerDirectionUp")]
        const Up = 1<<2;
        #[doc(alias = "UISwipeGestureRecognizerDirectionDown")]
        const Down = 1<<3;
    }
}

unsafe impl Encode for UISwipeGestureRecognizerDirection {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

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

#[cfg(feature = "UIGestureRecognizer")]
extern_conformance!(
    unsafe impl NSObjectProtocol for UISwipeGestureRecognizer {}
);

#[cfg(feature = "UIGestureRecognizer")]
impl UISwipeGestureRecognizer {
    extern_methods!(
        #[unsafe(method(numberOfTouchesRequired))]
        #[unsafe(method_family = none)]
        pub fn numberOfTouchesRequired(&self) -> NSUInteger;

        /// Setter for [`numberOfTouchesRequired`][Self::numberOfTouchesRequired].
        #[unsafe(method(setNumberOfTouchesRequired:))]
        #[unsafe(method_family = none)]
        pub fn setNumberOfTouchesRequired(&self, number_of_touches_required: NSUInteger);

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

        /// Setter for [`direction`][Self::direction].
        #[unsafe(method(setDirection:))]
        #[unsafe(method_family = none)]
        pub fn setDirection(&self, direction: UISwipeGestureRecognizerDirection);
    );
}

/// Methods declared on superclass `UIGestureRecognizer`.
#[cfg(feature = "UIGestureRecognizer")]
impl UISwipeGestureRecognizer {
    extern_methods!(
        /// # Safety
        ///
        /// - `target` should be of the correct type.
        /// - `action` must be a valid selector.
        #[unsafe(method(initWithTarget:action:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTarget_action(
            this: Allocated<Self>,
            target: Option<&AnyObject>,
            action: Option<Sel>,
        ) -> Retained<Self>;

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

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

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "UIGestureRecognizer")]
impl UISwipeGestureRecognizer {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
    );
}
