//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipressphase?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPressPhase(pub NSInteger);
impl UIPressPhase {
    #[doc(alias = "UIPressPhaseBegan")]
    pub const Began: Self = Self(0);
    #[doc(alias = "UIPressPhaseChanged")]
    pub const Changed: Self = Self(1);
    #[doc(alias = "UIPressPhaseStationary")]
    pub const Stationary: Self = Self(2);
    #[doc(alias = "UIPressPhaseEnded")]
    pub const Ended: Self = Self(3);
    #[doc(alias = "UIPressPhaseCancelled")]
    pub const Cancelled: Self = Self(4);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uipresstype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIPressType(pub NSInteger);
impl UIPressType {
    #[doc(alias = "UIPressTypeUpArrow")]
    pub const UpArrow: Self = Self(0);
    #[doc(alias = "UIPressTypeDownArrow")]
    pub const DownArrow: Self = Self(1);
    #[doc(alias = "UIPressTypeLeftArrow")]
    pub const LeftArrow: Self = Self(2);
    #[doc(alias = "UIPressTypeRightArrow")]
    pub const RightArrow: Self = Self(3);
    #[doc(alias = "UIPressTypeSelect")]
    pub const Select: Self = Self(4);
    #[doc(alias = "UIPressTypeMenu")]
    pub const Menu: Self = Self(5);
    #[doc(alias = "UIPressTypePlayPause")]
    pub const PlayPause: Self = Self(6);
    #[doc(alias = "UIPressTypePageUp")]
    pub const PageUp: Self = Self(30);
    #[doc(alias = "UIPressTypePageDown")]
    pub const PageDown: Self = Self(31);
    /// Represents a button on a TV remote labeled with 123. When this button is pressed, an app should provide UI to enter a specific channel number if channel
    /// numbers are available. If no channel numbers exist the app should provide UI to toggle channel category filters, search for channels by name or search for
    /// currently airing shows.
    #[doc(alias = "UIPressTypeTVRemoteOneTwoThree")]
    pub const TVRemoteOneTwoThree: Self = Self(32);
    /// Represents a button on a TV remote labeled with four colors, analogous to the four separate color buttons found on some TV remotes. When this button is
    /// pressed, an app should perform the appropriate color action or if there are multiple color actions available provide UI to choose the specific color.
    #[doc(alias = "UIPressTypeTVRemoteFourColors")]
    pub const TVRemoteFourColors: Self = Self(33);
}

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

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

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

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

impl UIPress {
    extern_methods!(
        #[unsafe(method(timestamp))]
        #[unsafe(method_family = none)]
        pub fn timestamp(&self) -> NSTimeInterval;

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

        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub fn r#type(&self) -> UIPressType;

        #[cfg(all(feature = "UIResponder", feature = "UIView", feature = "UIWindow"))]
        #[unsafe(method(window))]
        #[unsafe(method_family = none)]
        pub fn window(&self, mtm: MainThreadMarker) -> Option<Retained<UIWindow>>;

        #[cfg(feature = "UIResponder")]
        #[unsafe(method(responder))]
        #[unsafe(method_family = none)]
        pub fn responder(&self, mtm: MainThreadMarker) -> Option<Retained<UIResponder>>;

        #[cfg(feature = "UIGestureRecognizer")]
        #[unsafe(method(gestureRecognizers))]
        #[unsafe(method_family = none)]
        pub fn gestureRecognizers(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSArray<UIGestureRecognizer>>>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(force))]
        #[unsafe(method_family = none)]
        pub fn force(&self) -> CGFloat;

        #[cfg(feature = "UIKey")]
        /// For presses that originate from a hardware keyboard, contains a UIKey object describing the key being acted upon.
        /// This property is nil if the press did not originate from a hardware keyboard.
        #[unsafe(method(key))]
        #[unsafe(method_family = none)]
        pub fn key(&self, mtm: MainThreadMarker) -> Option<Retained<UIKey>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl UIPress {
    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() -> Retained<Self>;
    );
}

impl DefaultRetained for UIPress {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
