//! 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/uinotificationfeedbacktype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UINotificationFeedbackType(pub NSInteger);
impl UINotificationFeedbackType {
    #[doc(alias = "UINotificationFeedbackTypeSuccess")]
    pub const Success: Self = Self(0);
    #[doc(alias = "UINotificationFeedbackTypeWarning")]
    pub const Warning: Self = Self(1);
    #[doc(alias = "UINotificationFeedbackTypeError")]
    pub const Error: Self = Self(2);
}

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

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

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

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

#[cfg(feature = "UIFeedbackGenerator")]
impl UINotificationFeedbackGenerator {
    extern_methods!(
        /// call when a notification is displayed, passing the corresponding type
        #[unsafe(method(notificationOccurred:))]
        #[unsafe(method_family = none)]
        pub fn notificationOccurred(&self, notification_type: UINotificationFeedbackType);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(notificationOccurred:atLocation:))]
        #[unsafe(method_family = none)]
        pub fn notificationOccurred_atLocation(
            &self,
            notification_type: UINotificationFeedbackType,
            location: CGPoint,
        );
    );
}

/// Methods declared on superclass `UIFeedbackGenerator`.
#[cfg(feature = "UIFeedbackGenerator")]
impl UINotificationFeedbackGenerator {
    extern_methods!(
        #[cfg(all(feature = "UIResponder", feature = "UIView"))]
        /// initalize the generator with a view to attach it to the provided view as an interaction.
        #[unsafe(method(feedbackGeneratorForView:))]
        #[unsafe(method_family = none)]
        pub fn feedbackGeneratorForView(view: &UIView) -> Retained<Self>;

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

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