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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/intents/inbookrestaurantreservationintentcode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct INBookRestaurantReservationIntentCode(pub NSInteger);
impl INBookRestaurantReservationIntentCode {
    #[doc(alias = "INBookRestaurantReservationIntentCodeSuccess")]
    pub const Success: Self = Self(0);
    #[doc(alias = "INBookRestaurantReservationIntentCodeDenied")]
    pub const Denied: Self = Self(1);
    #[doc(alias = "INBookRestaurantReservationIntentCodeFailure")]
    pub const Failure: Self = Self(2);
    #[doc(alias = "INBookRestaurantReservationIntentCodeFailureRequiringAppLaunch")]
    pub const FailureRequiringAppLaunch: Self = Self(3);
    #[doc(
        alias = "INBookRestaurantReservationIntentCodeFailureRequiringAppLaunchMustVerifyCredentials"
    )]
    pub const FailureRequiringAppLaunchMustVerifyCredentials: Self = Self(4);
    #[doc(
        alias = "INBookRestaurantReservationIntentCodeFailureRequiringAppLaunchServiceTemporarilyUnavailable"
    )]
    pub const FailureRequiringAppLaunchServiceTemporarilyUnavailable: Self = Self(5);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/intents/inbookrestaurantreservationintentresponse?language=objc)
    #[unsafe(super(INIntentResponse, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "INIntentResponse")]
    pub struct INBookRestaurantReservationIntentResponse;
);

#[cfg(feature = "INIntentResponse")]
extern_conformance!(
    unsafe impl NSCoding for INBookRestaurantReservationIntentResponse {}
);

#[cfg(feature = "INIntentResponse")]
extern_conformance!(
    unsafe impl NSCopying for INBookRestaurantReservationIntentResponse {}
);

#[cfg(feature = "INIntentResponse")]
unsafe impl CopyingHelper for INBookRestaurantReservationIntentResponse {
    type Result = Self;
}

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

#[cfg(feature = "INIntentResponse")]
extern_conformance!(
    unsafe impl NSSecureCoding for INBookRestaurantReservationIntentResponse {}
);

#[cfg(feature = "INIntentResponse")]
impl INBookRestaurantReservationIntentResponse {
    extern_methods!(
        #[unsafe(method(initWithCode:userActivity:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCode_userActivity(
            this: Allocated<Self>,
            code: INBookRestaurantReservationIntentCode,
            user_activity: Option<&NSUserActivity>,
        ) -> Retained<Self>;

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

        #[cfg(all(
            feature = "INRestaurantReservationBooking",
            feature = "INRestaurantReservationUserBooking"
        ))]
        #[unsafe(method(userBooking))]
        #[unsafe(method_family = none)]
        pub unsafe fn userBooking(&self) -> Option<Retained<INRestaurantReservationUserBooking>>;

        #[cfg(all(
            feature = "INRestaurantReservationBooking",
            feature = "INRestaurantReservationUserBooking"
        ))]
        /// Setter for [`userBooking`][Self::userBooking].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setUserBooking:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserBooking(
            &self,
            user_booking: Option<&INRestaurantReservationUserBooking>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "INIntentResponse")]
impl INBookRestaurantReservationIntentResponse {
    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>;
    );
}