//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UNAuthorizationOptions(pub NSUInteger);
bitflags::bitflags! {
    impl UNAuthorizationOptions: NSUInteger {
        const UNAuthorizationOptionBadge = 1<<0;
        const UNAuthorizationOptionSound = 1<<1;
        const UNAuthorizationOptionAlert = 1<<2;
        const UNAuthorizationOptionCarPlay = 1<<3;
        const UNAuthorizationOptionCriticalAlert = 1<<4;
        const UNAuthorizationOptionProvidesAppNotificationSettings = 1<<5;
        const UNAuthorizationOptionProvisional = 1<<6;
#[deprecated = "Announcement authorization is always included"]
        const UNAuthorizationOptionAnnouncement = 1<<7;
#[deprecated = "Use time-sensitive entitlement"]
        const UNAuthorizationOptionTimeSensitive = 1<<8;
    }
}

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

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

pub static UNAuthorizationOptionNone: UNAuthorizationOptions = UNAuthorizationOptions(0);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct UNUserNotificationCenter;

    unsafe impl ClassType for UNUserNotificationCenter {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for UNUserNotificationCenter {}

extern_methods!(
    unsafe impl UNUserNotificationCenter {
        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(
            &self,
        ) -> Option<Retained<ProtocolObject<dyn UNUserNotificationCenterDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn UNUserNotificationCenterDelegate>>,
        );

        #[method(supportsContentExtensions)]
        pub unsafe fn supportsContentExtensions(&self) -> bool;

        #[method_id(@__retain_semantics Other currentNotificationCenter)]
        pub unsafe fn currentNotificationCenter() -> Retained<UNUserNotificationCenter>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "block2")]
        #[method(requestAuthorizationWithOptions:completionHandler:)]
        pub unsafe fn requestAuthorizationWithOptions_completionHandler(
            &self,
            options: UNAuthorizationOptions,
            completion_handler: &block2::Block<dyn Fn(Bool, *mut NSError)>,
        );

        #[cfg(feature = "UNNotificationCategory")]
        #[method(setNotificationCategories:)]
        pub unsafe fn setNotificationCategories(&self, categories: &NSSet<UNNotificationCategory>);

        #[cfg(all(feature = "UNNotificationCategory", feature = "block2"))]
        #[method(getNotificationCategoriesWithCompletionHandler:)]
        pub unsafe fn getNotificationCategoriesWithCompletionHandler(
            &self,
            completion_handler: &block2::Block<dyn Fn(NonNull<NSSet<UNNotificationCategory>>)>,
        );

        #[cfg(all(feature = "UNNotificationSettings", feature = "block2"))]
        #[method(getNotificationSettingsWithCompletionHandler:)]
        pub unsafe fn getNotificationSettingsWithCompletionHandler(
            &self,
            completion_handler: &block2::Block<dyn Fn(NonNull<UNNotificationSettings>)>,
        );

        #[cfg(all(feature = "UNNotificationRequest", feature = "block2"))]
        #[method(addNotificationRequest:withCompletionHandler:)]
        pub unsafe fn addNotificationRequest_withCompletionHandler(
            &self,
            request: &UNNotificationRequest,
            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
        );

        #[cfg(all(feature = "UNNotificationRequest", feature = "block2"))]
        #[method(getPendingNotificationRequestsWithCompletionHandler:)]
        pub unsafe fn getPendingNotificationRequestsWithCompletionHandler(
            &self,
            completion_handler: &block2::Block<dyn Fn(NonNull<NSArray<UNNotificationRequest>>)>,
        );

        #[method(removePendingNotificationRequestsWithIdentifiers:)]
        pub unsafe fn removePendingNotificationRequestsWithIdentifiers(
            &self,
            identifiers: &NSArray<NSString>,
        );

        #[method(removeAllPendingNotificationRequests)]
        pub unsafe fn removeAllPendingNotificationRequests(&self);

        #[cfg(all(feature = "UNNotification", feature = "block2"))]
        #[method(getDeliveredNotificationsWithCompletionHandler:)]
        pub unsafe fn getDeliveredNotificationsWithCompletionHandler(
            &self,
            completion_handler: &block2::Block<dyn Fn(NonNull<NSArray<UNNotification>>)>,
        );

        #[method(removeDeliveredNotificationsWithIdentifiers:)]
        pub unsafe fn removeDeliveredNotificationsWithIdentifiers(
            &self,
            identifiers: &NSArray<NSString>,
        );

        #[method(removeAllDeliveredNotifications)]
        pub unsafe fn removeAllDeliveredNotifications(&self);

        #[cfg(feature = "block2")]
        #[method(setBadgeCount:withCompletionHandler:)]
        pub unsafe fn setBadgeCount_withCompletionHandler(
            &self,
            new_badge_count: NSInteger,
            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl UNUserNotificationCenter {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UNNotificationPresentationOptions(pub NSUInteger);
bitflags::bitflags! {
    impl UNNotificationPresentationOptions: NSUInteger {
        const UNNotificationPresentationOptionBadge = 1<<0;
        const UNNotificationPresentationOptionSound = 1<<1;
#[deprecated]
        const UNNotificationPresentationOptionAlert = 1<<2;
        const UNNotificationPresentationOptionList = 1<<3;
        const UNNotificationPresentationOptionBanner = 1<<4;
    }
}

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

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

pub static UNNotificationPresentationOptionNone: UNNotificationPresentationOptions =
    UNNotificationPresentationOptions(0);

extern_protocol!(
    pub unsafe trait UNUserNotificationCenterDelegate: NSObjectProtocol {
        #[cfg(all(feature = "UNNotification", feature = "block2"))]
        #[optional]
        #[method(userNotificationCenter:willPresentNotification:withCompletionHandler:)]
        unsafe fn userNotificationCenter_willPresentNotification_withCompletionHandler(
            &self,
            center: &UNUserNotificationCenter,
            notification: &UNNotification,
            completion_handler: &block2::Block<dyn Fn(UNNotificationPresentationOptions)>,
        );

        #[cfg(all(feature = "UNNotificationResponse", feature = "block2"))]
        #[optional]
        #[method(userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:)]
        unsafe fn userNotificationCenter_didReceiveNotificationResponse_withCompletionHandler(
            &self,
            center: &UNUserNotificationCenter,
            response: &UNNotificationResponse,
            completion_handler: &block2::Block<dyn Fn()>,
        );

        #[cfg(feature = "UNNotification")]
        #[optional]
        #[method(userNotificationCenter:openSettingsForNotification:)]
        unsafe fn userNotificationCenter_openSettingsForNotification(
            &self,
            center: &UNUserNotificationCenter,
            notification: Option<&UNNotification>,
        );
    }

    unsafe impl ProtocolType for dyn UNUserNotificationCenterDelegate {}
);
