objc2-pass-kit 0.3.2

Bindings to the PassKit 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/passkit/pkpaymentpassactivationstate?language=objc)
// NS_ENUM
#[deprecated = "Use PKSecureElementPassActivationState instead"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PKPaymentPassActivationState(pub NSUInteger);
impl PKPaymentPassActivationState {
    #[doc(alias = "PKPaymentPassActivationStateActivated")]
    #[deprecated = "Use PKSecureElementPassActivationState instead"]
    pub const Activated: Self = Self(0);
    #[doc(alias = "PKPaymentPassActivationStateRequiresActivation")]
    #[deprecated = "Use PKSecureElementPassActivationState instead"]
    pub const RequiresActivation: Self = Self(1);
    #[doc(alias = "PKPaymentPassActivationStateActivating")]
    #[deprecated = "Use PKSecureElementPassActivationState instead"]
    pub const Activating: Self = Self(2);
    #[doc(alias = "PKPaymentPassActivationStateSuspended")]
    #[deprecated = "Use PKSecureElementPassActivationState instead"]
    pub const Suspended: Self = Self(3);
    #[doc(alias = "PKPaymentPassActivationStateDeactivated")]
    #[deprecated = "Use PKSecureElementPassActivationState instead"]
    pub const Deactivated: Self = Self(4);
}

unsafe impl Encode for PKPaymentPassActivationState {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/passkit/pkpaymentpass?language=objc)
    #[unsafe(super(PKSecureElementPass, PKPass, PKObject, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(
        feature = "PKObject",
        feature = "PKPass",
        feature = "PKSecureElementPass"
    ))]
    pub struct PKPaymentPass;
);

#[cfg(all(
    feature = "PKObject",
    feature = "PKPass",
    feature = "PKSecureElementPass"
))]
extern_conformance!(
    unsafe impl NSObjectProtocol for PKPaymentPass {}
);

#[cfg(all(
    feature = "PKObject",
    feature = "PKPass",
    feature = "PKSecureElementPass"
))]
impl PKPaymentPass {
    extern_methods!(
        #[deprecated = "Use [PKSecureElementPass passActivationState] instead"]
        #[unsafe(method(activationState))]
        #[unsafe(method_family = none)]
        pub unsafe fn activationState(&self) -> PKPaymentPassActivationState;
    );
}

/// Methods declared on superclass `PKPass`.
#[cfg(all(
    feature = "PKObject",
    feature = "PKPass",
    feature = "PKSecureElementPass"
))]
impl PKPaymentPass {
    extern_methods!(
        #[unsafe(method(initWithData:error:_))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithData_error(
            this: Allocated<Self>,
            data: &NSData,
        ) -> Result<Retained<Self>, Retained<NSError>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(
    feature = "PKObject",
    feature = "PKPass",
    feature = "PKSecureElementPass"
))]
impl PKPaymentPass {
    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>;
    );
}