objc2-intents 0.3.2

Bindings to the Intents framework
Documentation
//! 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 objc2_foundation::*;

use crate::*;

/// The role of the relevant shortcut.
///
/// Provides a hint to Siri about the expected user experience.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/intents/inrelevantshortcutrole?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct INRelevantShortcutRole(pub NSInteger);
impl INRelevantShortcutRole {
    /// The relevant shortcut represents an action that the user may want to perform using your app.
    #[doc(alias = "INRelevantShortcutRoleAction")]
    pub const Action: Self = Self(0);
    /// The relevant shortcut represents information that the user may want to glance at.
    #[doc(alias = "INRelevantShortcutRoleInformation")]
    pub const Information: Self = Self(1);
}

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

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

extern_class!(
    /// Lets you provide relevant shortcut to Siri, for display on the Siri Watch Face.
    ///
    /// Including relevance information allows Siri to make suggestions for shortcuts that the user might be interested in but has not previously performed.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/intents/inrelevantshortcut?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct INRelevantShortcut;
);

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

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

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

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

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

impl INRelevantShortcut {
    extern_methods!(
        #[cfg(feature = "INRelevanceProvider")]
        /// A collection of relevance information that is attached to the relevant shortcuts.
        ///
        /// Providing additional relevance information allows Siri to suggest a shortcut that the user is interested in but has not previously performed.
        ///
        /// See also: INRelevanceProvider
        #[unsafe(method(relevanceProviders))]
        #[unsafe(method_family = none)]
        pub unsafe fn relevanceProviders(&self) -> Retained<NSArray<INRelevanceProvider>>;

        #[cfg(feature = "INRelevanceProvider")]
        /// Setter for [`relevanceProviders`][Self::relevanceProviders].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setRelevanceProviders:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRelevanceProviders(
            &self,
            relevance_providers: &NSArray<INRelevanceProvider>,
        );

        #[cfg(feature = "INDefaultCardTemplate")]
        /// Customizes the display of the relevant shortcut on the Siri watch face.
        ///
        /// By default, the UI for the relevant shortcut can be derivied from the information provided in the
        /// `INShortcut.`In certain situations, it may be desirable to override this behavior and provide a custom template.
        ///
        /// See also: INDefaultCardTemplate
        #[unsafe(method(watchTemplate))]
        #[unsafe(method_family = none)]
        pub unsafe fn watchTemplate(&self) -> Option<Retained<INDefaultCardTemplate>>;

        #[cfg(feature = "INDefaultCardTemplate")]
        /// Setter for [`watchTemplate`][Self::watchTemplate].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setWatchTemplate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setWatchTemplate(&self, watch_template: Option<&INDefaultCardTemplate>);

        /// Links the relevant shortcut to a specific WidgetKit widget kind.
        ///
        /// When a relevant shortcut is linked to a WidgetKit widget, it hints to the system when to show the widget in a stack.
        #[unsafe(method(widgetKind))]
        #[unsafe(method_family = none)]
        pub unsafe fn widgetKind(&self) -> Option<Retained<NSString>>;

        /// Setter for [`widgetKind`][Self::widgetKind].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setWidgetKind:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setWidgetKind(&self, widget_kind: Option<&NSString>);

        /// The role of the relevant shortcut.
        ///
        /// Provides a hint to Siri about the expected user experience. The default is
        /// `INRelevantShortcutRoleAction.`
        /// See also: INRelevantShortcutRole
        #[unsafe(method(shortcutRole))]
        #[unsafe(method_family = none)]
        pub unsafe fn shortcutRole(&self) -> INRelevantShortcutRole;

        /// Setter for [`shortcutRole`][Self::shortcutRole].
        #[unsafe(method(setShortcutRole:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setShortcutRole(&self, shortcut_role: INRelevantShortcutRole);

        #[cfg(feature = "INShortcut")]
        /// The shortcut that will be performed when this relevant shortcut is invoked.
        ///
        /// See also: INShortcut
        #[unsafe(method(shortcut))]
        #[unsafe(method_family = none)]
        pub unsafe fn shortcut(&self) -> Retained<INShortcut>;

        #[cfg(feature = "INShortcut")]
        /// Creates a relevant shortcut for the given shortcut.
        #[unsafe(method(initWithShortcut:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithShortcut(
            this: Allocated<Self>,
            shortcut: &INShortcut,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl INRelevantShortcut {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}