objc2-store-kit 0.2.2

Bindings to the StoreKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKProductDiscountPaymentMode(pub NSUInteger);
impl SKProductDiscountPaymentMode {
    #[doc(alias = "SKProductDiscountPaymentModePayAsYouGo")]
    pub const PayAsYouGo: Self = Self(0);
    #[doc(alias = "SKProductDiscountPaymentModePayUpFront")]
    pub const PayUpFront: Self = Self(1);
    #[doc(alias = "SKProductDiscountPaymentModeFreeTrial")]
    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);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SKProductDiscountType(pub NSUInteger);
impl SKProductDiscountType {
    #[doc(alias = "SKProductDiscountTypeIntroductory")]
    pub const Introductory: Self = Self(0);
    #[doc(alias = "SKProductDiscountTypeSubscription")]
    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!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SKProductDiscount;

    unsafe impl ClassType for SKProductDiscount {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for SKProductDiscount {}

unsafe impl Sync for SKProductDiscount {}

unsafe impl NSObjectProtocol for SKProductDiscount {}

extern_methods!(
    unsafe impl SKProductDiscount {
        #[method_id(@__retain_semantics Other price)]
        pub unsafe fn price(&self) -> Retained<NSDecimalNumber>;

        #[method_id(@__retain_semantics Other priceLocale)]
        pub unsafe fn priceLocale(&self) -> Retained<NSLocale>;

        #[method_id(@__retain_semantics Other identifier)]
        pub unsafe fn identifier(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "SKProduct")]
        #[method_id(@__retain_semantics Other subscriptionPeriod)]
        pub unsafe fn subscriptionPeriod(&self) -> Retained<SKProductSubscriptionPeriod>;

        #[method(numberOfPeriods)]
        pub unsafe fn numberOfPeriods(&self) -> NSUInteger;

        #[method(paymentMode)]
        pub unsafe fn paymentMode(&self) -> SKProductDiscountPaymentMode;

        #[method(type)]
        pub unsafe fn r#type(&self) -> SKProductDiscountType;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl SKProductDiscount {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);