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/incancelrideintentresponsecode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct INCancelRideIntentResponseCode(pub NSInteger);
impl INCancelRideIntentResponseCode {
    #[doc(alias = "INCancelRideIntentResponseCodeUnspecified")]
    pub const Unspecified: Self = Self(0);
    #[doc(alias = "INCancelRideIntentResponseCodeReady")]
    pub const Ready: Self = Self(1);
    #[doc(alias = "INCancelRideIntentResponseCodeSuccess")]
    pub const Success: Self = Self(2);
    #[doc(alias = "INCancelRideIntentResponseCodeFailure")]
    pub const Failure: Self = Self(3);
}

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

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

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

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

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

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

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

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

#[cfg(feature = "INIntentResponse")]
impl INCancelRideIntentResponse {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(initWithCode:userActivity:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCode_userActivity(
            this: Allocated<Self>,
            code: INCancelRideIntentResponseCode,
            user_activity: Option<&NSUserActivity>,
        ) -> Retained<Self>;

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

        #[cfg(feature = "INCurrencyAmount")]
        #[unsafe(method(cancellationFee))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancellationFee(&self) -> Option<Retained<INCurrencyAmount>>;

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

        #[unsafe(method(cancellationFeeThreshold))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancellationFeeThreshold(&self) -> Option<Retained<NSDateComponents>>;

        /// Setter for [`cancellationFeeThreshold`][Self::cancellationFeeThreshold].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setCancellationFeeThreshold:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCancellationFeeThreshold(
            &self,
            cancellation_fee_threshold: Option<&NSDateComponents>,
        );
    );
}

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