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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nspostingstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPostingStyle(pub NSUInteger);
impl NSPostingStyle {
    #[doc(alias = "NSPostWhenIdle")]
    pub const PostWhenIdle: Self = Self(1);
    #[doc(alias = "NSPostASAP")]
    pub const PostASAP: Self = Self(2);
    #[doc(alias = "NSPostNow")]
    pub const PostNow: Self = Self(3);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnotificationcoalescing?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSNotificationCoalescing(pub NSUInteger);
bitflags::bitflags! {
    impl NSNotificationCoalescing: NSUInteger {
        #[doc(alias = "NSNotificationNoCoalescing")]
        const NoCoalescing = 0;
        #[doc(alias = "NSNotificationCoalescingOnName")]
        const CoalescingOnName = 1;
        #[doc(alias = "NSNotificationCoalescingOnSender")]
        const CoalescingOnSender = 2;
    }
}

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

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

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

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

impl NSNotificationQueue {
    extern_methods!(
        #[unsafe(method(defaultQueue))]
        #[unsafe(method_family = none)]
        pub fn defaultQueue() -> Retained<NSNotificationQueue>;

        #[cfg(feature = "NSNotification")]
        #[unsafe(method(initWithNotificationCenter:))]
        #[unsafe(method_family = init)]
        pub fn initWithNotificationCenter(
            this: Allocated<Self>,
            notification_center: &NSNotificationCenter,
        ) -> Retained<Self>;

        #[cfg(feature = "NSNotification")]
        #[unsafe(method(enqueueNotification:postingStyle:))]
        #[unsafe(method_family = none)]
        pub fn enqueueNotification_postingStyle(
            &self,
            notification: &NSNotification,
            posting_style: NSPostingStyle,
        );

        #[cfg(all(
            feature = "NSArray",
            feature = "NSNotification",
            feature = "NSObjCRuntime",
            feature = "NSString"
        ))]
        #[unsafe(method(enqueueNotification:postingStyle:coalesceMask:forModes:))]
        #[unsafe(method_family = none)]
        pub fn enqueueNotification_postingStyle_coalesceMask_forModes(
            &self,
            notification: &NSNotification,
            posting_style: NSPostingStyle,
            coalesce_mask: NSNotificationCoalescing,
            modes: Option<&NSArray<NSRunLoopMode>>,
        );

        #[cfg(feature = "NSNotification")]
        #[unsafe(method(dequeueNotificationsMatching:coalesceMask:))]
        #[unsafe(method_family = none)]
        pub fn dequeueNotificationsMatching_coalesceMask(
            &self,
            notification: &NSNotification,
            coalesce_mask: NSUInteger,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl NSNotificationQueue {
    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 NSNotificationQueue {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
