objc2-store-kit 0.3.2

Bindings to the StoreKit 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/storekit/skproductdiscountpaymentmode?language=objc)
// NS_ENUM
#[deprecated = "Use Product.SubscriptionOffer.PaymentMode"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKProductDiscountPaymentMode(pub NSUInteger);
impl SKProductDiscountPaymentMode {
    #[doc(alias = "SKProductDiscountPaymentModePayAsYouGo")]
    #[deprecated = "Use Product.SubscriptionOffer.PaymentMode"]
    pub const PayAsYouGo: Self = Self(0);
    #[doc(alias = "SKProductDiscountPaymentModePayUpFront")]
    #[deprecated = "Use Product.SubscriptionOffer.PaymentMode"]
    pub const PayUpFront: Self = Self(1);
    #[doc(alias = "SKProductDiscountPaymentModeFreeTrial")]
    #[deprecated = "Use Product.SubscriptionOffer.PaymentMode"]
    pub const FreeTrial: Self = Self(2);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/storekit/skproductdiscounttype?language=objc)
// NS_ENUM
#[deprecated = "Use Product.SubscriptionOffer.OfferType"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKProductDiscountType(pub NSUInteger);
impl SKProductDiscountType {
    #[doc(alias = "SKProductDiscountTypeIntroductory")]
    #[deprecated = "Use Product.SubscriptionOffer.OfferType"]
    pub const Introductory: Self = Self(0);
    #[doc(alias = "SKProductDiscountTypeSubscription")]
    #[deprecated = "Use Product.SubscriptionOffer.OfferType"]
    pub const Subscription: Self = Self(1);
}

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/storekit/skproductdiscount?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated = "Use Product.SubscriptionOffer"]
    pub struct SKProductDiscount;
);

unsafe impl Send for SKProductDiscount {}

unsafe impl Sync for SKProductDiscount {}

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

impl SKProductDiscount {
    extern_methods!(
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.SubscriptionOffer.displayPrice"]
        #[unsafe(method(price))]
        #[unsafe(method_family = none)]
        pub unsafe fn price(&self) -> Retained<NSDecimalNumber>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.SubscriptionOffer.displayPrice"]
        #[unsafe(method(priceLocale))]
        #[unsafe(method_family = none)]
        pub unsafe fn priceLocale(&self) -> Retained<NSLocale>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.SubscriptionOffer.id"]
        #[unsafe(method(identifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "SKProduct")]
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.SubscriptionOffer.period"]
        #[unsafe(method(subscriptionPeriod))]
        #[unsafe(method_family = none)]
        pub unsafe fn subscriptionPeriod(&self) -> Retained<SKProductSubscriptionPeriod>;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.SubscriptionOffer.periodCount"]
        #[unsafe(method(numberOfPeriods))]
        #[unsafe(method_family = none)]
        pub unsafe fn numberOfPeriods(&self) -> NSUInteger;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.SubscriptionOffer.paymentMode"]
        #[unsafe(method(paymentMode))]
        #[unsafe(method_family = none)]
        pub unsafe fn paymentMode(&self) -> SKProductDiscountPaymentMode;

        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[deprecated = "Use Product.SubscriptionOffer.type"]
        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub unsafe fn r#type(&self) -> SKProductDiscountType;
    );
}

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