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/inrequestpaymentintentresponsecode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct INRequestPaymentIntentResponseCode(pub NSInteger);
impl INRequestPaymentIntentResponseCode {
    #[doc(alias = "INRequestPaymentIntentResponseCodeUnspecified")]
    pub const Unspecified: Self = Self(0);
    #[doc(alias = "INRequestPaymentIntentResponseCodeReady")]
    pub const Ready: Self = Self(1);
    #[doc(alias = "INRequestPaymentIntentResponseCodeInProgress")]
    pub const InProgress: Self = Self(2);
    #[doc(alias = "INRequestPaymentIntentResponseCodeSuccess")]
    pub const Success: Self = Self(3);
    #[doc(alias = "INRequestPaymentIntentResponseCodeFailure")]
    pub const Failure: Self = Self(4);
    #[doc(alias = "INRequestPaymentIntentResponseCodeFailureRequiringAppLaunch")]
    pub const FailureRequiringAppLaunch: Self = Self(5);
    #[doc(alias = "INRequestPaymentIntentResponseCodeFailureCredentialsUnverified")]
    pub const FailureCredentialsUnverified: Self = Self(6);
    #[doc(alias = "INRequestPaymentIntentResponseCodeFailurePaymentsAmountBelowMinimum")]
    pub const FailurePaymentsAmountBelowMinimum: Self = Self(7);
    #[doc(alias = "INRequestPaymentIntentResponseCodeFailurePaymentsAmountAboveMaximum")]
    pub const FailurePaymentsAmountAboveMaximum: Self = Self(8);
    #[doc(alias = "INRequestPaymentIntentResponseCodeFailurePaymentsCurrencyUnsupported")]
    pub const FailurePaymentsCurrencyUnsupported: Self = Self(9);
    #[doc(alias = "INRequestPaymentIntentResponseCodeFailureNoBankAccount")]
    pub const FailureNoBankAccount: Self = Self(10);
    #[doc(alias = "INRequestPaymentIntentResponseCodeFailureNotEligible")]
    pub const FailureNotEligible: Self = Self(11);
    #[doc(alias = "INRequestPaymentIntentResponseCodeFailureTermsAndConditionsAcceptanceRequired")]
    pub const FailureTermsAndConditionsAcceptanceRequired: Self = Self(12);
}

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

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

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

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

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

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

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

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

#[cfg(feature = "INIntentResponse")]
impl INRequestPaymentIntentResponse {
    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: INRequestPaymentIntentResponseCode,
            user_activity: Option<&NSUserActivity>,
        ) -> Retained<Self>;

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

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

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

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