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::*;
#[cfg(feature = "objc2-contacts")]
use objc2_contacts::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/passkit/pkpaymentmethodtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PKPaymentMethodType(pub NSUInteger);
impl PKPaymentMethodType {
    #[doc(alias = "PKPaymentMethodTypeUnknown")]
    pub const Unknown: Self = Self(0);
    #[doc(alias = "PKPaymentMethodTypeDebit")]
    pub const Debit: Self = Self(1);
    #[doc(alias = "PKPaymentMethodTypeCredit")]
    pub const Credit: Self = Self(2);
    #[doc(alias = "PKPaymentMethodTypePrepaid")]
    pub const Prepaid: Self = Self(3);
    #[doc(alias = "PKPaymentMethodTypeStore")]
    pub const Store: Self = Self(4);
    #[doc(alias = "PKPaymentMethodTypeEMoney")]
    pub const EMoney: Self = Self(5);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/passkit/pkpaymentmethod?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PKPaymentMethod;
);

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

impl PKPaymentMethod {
    extern_methods!(
        #[unsafe(method(displayName))]
        #[unsafe(method_family = none)]
        pub unsafe fn displayName(&self) -> Option<Retained<NSString>>;

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

        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub unsafe fn r#type(&self) -> PKPaymentMethodType;

        #[cfg(all(
            feature = "PKObject",
            feature = "PKPass",
            feature = "PKPaymentPass",
            feature = "PKSecureElementPass"
        ))]
        #[deprecated = "Use -[PKPass secureElementPass] instead"]
        #[unsafe(method(paymentPass))]
        #[unsafe(method_family = none)]
        pub unsafe fn paymentPass(&self) -> Option<Retained<PKPaymentPass>>;

        #[cfg(all(
            feature = "PKObject",
            feature = "PKPass",
            feature = "PKSecureElementPass"
        ))]
        #[unsafe(method(secureElementPass))]
        #[unsafe(method_family = none)]
        pub unsafe fn secureElementPass(&self) -> Option<Retained<PKSecureElementPass>>;

        #[cfg(feature = "objc2-contacts")]
        #[unsafe(method(billingAddress))]
        #[unsafe(method_family = none)]
        pub unsafe fn billingAddress(&self) -> Option<Retained<CNContact>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl PKPaymentMethod {
    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>;
    );
}