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::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/passkit/pkpaymentsummaryitemtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct PKPaymentSummaryItemType(pub NSUInteger);
impl PKPaymentSummaryItemType {
    #[doc(alias = "PKPaymentSummaryItemTypeFinal")]
    pub const Final: Self = Self(0);
    #[doc(alias = "PKPaymentSummaryItemTypePending")]
    pub const Pending: Self = Self(1);
}

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

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

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

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

impl PKPaymentSummaryItem {
    extern_methods!(
        #[unsafe(method(summaryItemWithLabel:amount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn summaryItemWithLabel_amount(
            label: &NSString,
            amount: &NSDecimalNumber,
        ) -> Retained<Self>;

        #[unsafe(method(summaryItemWithLabel:amount:type:))]
        #[unsafe(method_family = none)]
        pub unsafe fn summaryItemWithLabel_amount_type(
            label: &NSString,
            amount: &NSDecimalNumber,
            r#type: PKPaymentSummaryItemType,
        ) -> Retained<Self>;

        #[unsafe(method(label))]
        #[unsafe(method_family = none)]
        pub unsafe fn label(&self) -> Retained<NSString>;

        /// Setter for [`label`][Self::label].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setLabel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLabel(&self, label: &NSString);

        #[unsafe(method(amount))]
        #[unsafe(method_family = none)]
        pub unsafe fn amount(&self) -> Retained<NSDecimalNumber>;

        /// Setter for [`amount`][Self::amount].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setAmount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAmount(&self, amount: &NSDecimalNumber);

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

        /// Setter for [`type`][Self::type].
        #[unsafe(method(setType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setType(&self, r#type: PKPaymentSummaryItemType);
    );
}

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