//! 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/uitouchphase?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITouchPhase(pub NSInteger);
impl UITouchPhase {
    #[doc(alias = "UITouchPhaseBegan")]
    pub const Began: Self = Self(0);
    #[doc(alias = "UITouchPhaseMoved")]
    pub const Moved: Self = Self(1);
    #[doc(alias = "UITouchPhaseStationary")]
    pub const Stationary: Self = Self(2);
    #[doc(alias = "UITouchPhaseEnded")]
    pub const Ended: Self = Self(3);
    #[doc(alias = "UITouchPhaseCancelled")]
    pub const Cancelled: Self = Self(4);
    #[doc(alias = "UITouchPhaseRegionEntered")]
    pub const RegionEntered: Self = Self(5);
    #[doc(alias = "UITouchPhaseRegionMoved")]
    pub const RegionMoved: Self = Self(6);
    #[doc(alias = "UITouchPhaseRegionExited")]
    pub const RegionExited: Self = Self(7);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiforcetouchcapability?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIForceTouchCapability(pub NSInteger);
impl UIForceTouchCapability {
    #[doc(alias = "UIForceTouchCapabilityUnknown")]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "UIForceTouchCapabilityUnavailable")]
    pub const Unavailable: Self = Self(1);
    #[doc(alias = "UIForceTouchCapabilityAvailable")]
    pub const Available: Self = Self(2);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitouchtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITouchType(pub NSInteger);
impl UITouchType {
    #[doc(alias = "UITouchTypeDirect")]
    pub const Direct: Self = Self(0);
    #[doc(alias = "UITouchTypeIndirect")]
    pub const Indirect: Self = Self(1);
    #[doc(alias = "UITouchTypePencil")]
    pub const Pencil: Self = Self(2);
    #[doc(alias = "UITouchTypeStylus")]
    pub const Stylus: Self = Self(UITouchType::Pencil.0);
    #[doc(alias = "UITouchTypeIndirectPointer")]
    pub const IndirectPointer: Self = Self(3);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitouchproperties?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UITouchProperties(pub NSInteger);
bitflags::bitflags! {
    impl UITouchProperties: NSInteger {
        #[doc(alias = "UITouchPropertyForce")]
        const Force = 1<<0;
        #[doc(alias = "UITouchPropertyAzimuth")]
        const Azimuth = 1<<1;
        #[doc(alias = "UITouchPropertyAltitude")]
        const Altitude = 1<<2;
        #[doc(alias = "UITouchPropertyLocation")]
        const Location = 1<<3;
        #[doc(alias = "UITouchPropertyRoll")]
        const Roll = 1<<4;
    }
}

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

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

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

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

impl UITouch {
    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) -> UITouchPhase;

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

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

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

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

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

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

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

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(locationInView:))]
        #[unsafe(method_family = none)]
        pub fn locationInView(&self, view: Option<&UIView>) -> CGPoint;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(previousLocationInView:))]
        #[unsafe(method_family = none)]
        pub fn previousLocationInView(&self, view: Option<&UIView>) -> CGPoint;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(preciseLocationInView:))]
        #[unsafe(method_family = none)]
        pub fn preciseLocationInView(&self, view: Option<&UIView>) -> CGPoint;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(precisePreviousLocationInView:))]
        #[unsafe(method_family = none)]
        pub fn precisePreviousLocationInView(&self, view: Option<&UIView>) -> CGPoint;

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

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

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(azimuthAngleInView:))]
        #[unsafe(method_family = none)]
        pub fn azimuthAngleInView(&self, view: Option<&UIView>) -> CGFloat;

        #[cfg(all(
            feature = "UIResponder",
            feature = "UIView",
            feature = "objc2-core-foundation"
        ))]
        #[unsafe(method(azimuthUnitVectorInView:))]
        #[unsafe(method_family = none)]
        pub fn azimuthUnitVectorInView(&self, view: Option<&UIView>) -> CGVector;

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

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

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

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

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

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