objc2-user-notifications 0.3.2

Bindings to the UserNotifications framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/usernotifications/unauthorizationstatus?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UNAuthorizationStatus(pub NSInteger);
impl UNAuthorizationStatus {
    #[doc(alias = "UNAuthorizationStatusNotDetermined")]
    pub const NotDetermined: Self = Self(0);
    #[doc(alias = "UNAuthorizationStatusDenied")]
    pub const Denied: Self = Self(1);
    #[doc(alias = "UNAuthorizationStatusAuthorized")]
    pub const Authorized: Self = Self(2);
    #[doc(alias = "UNAuthorizationStatusProvisional")]
    pub const Provisional: Self = Self(3);
    #[doc(alias = "UNAuthorizationStatusEphemeral")]
    pub const Ephemeral: Self = Self(4);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/usernotifications/unshowpreviewssetting?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UNShowPreviewsSetting(pub NSInteger);
impl UNShowPreviewsSetting {
    #[doc(alias = "UNShowPreviewsSettingAlways")]
    pub const Always: Self = Self(0);
    #[doc(alias = "UNShowPreviewsSettingWhenAuthenticated")]
    pub const WhenAuthenticated: Self = Self(1);
    #[doc(alias = "UNShowPreviewsSettingNever")]
    pub const Never: Self = Self(2);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/usernotifications/unnotificationsetting?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UNNotificationSetting(pub NSInteger);
impl UNNotificationSetting {
    #[doc(alias = "UNNotificationSettingNotSupported")]
    pub const NotSupported: Self = Self(0);
    #[doc(alias = "UNNotificationSettingDisabled")]
    pub const Disabled: Self = Self(1);
    #[doc(alias = "UNNotificationSettingEnabled")]
    pub const Enabled: Self = Self(2);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/usernotifications/unalertstyle?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UNAlertStyle(pub NSInteger);
impl UNAlertStyle {
    #[doc(alias = "UNAlertStyleNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "UNAlertStyleBanner")]
    pub const Banner: Self = Self(1);
    #[doc(alias = "UNAlertStyleAlert")]
    pub const Alert: Self = Self(2);
}

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

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

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

extern_conformance!(
    unsafe impl NSCoding for UNNotificationSettings {}
);

extern_conformance!(
    unsafe impl NSCopying for UNNotificationSettings {}
);

unsafe impl CopyingHelper for UNNotificationSettings {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for UNNotificationSettings {}
);

impl UNNotificationSettings {
    extern_methods!(
        #[unsafe(method(authorizationStatus))]
        #[unsafe(method_family = none)]
        pub fn authorizationStatus(&self) -> UNAuthorizationStatus;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

/// Methods declared on superclass `NSObject`.
impl UNNotificationSettings {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}