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

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/passkit/pkshareablepassmetadatapreview?language=objc)
    #[unsafe(super(PKAddPassMetadataPreview, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "PKAddSecureElementPassConfiguration")]
    pub struct PKShareablePassMetadataPreview;
);

#[cfg(feature = "PKAddSecureElementPassConfiguration")]
extern_conformance!(
    unsafe impl NSObjectProtocol for PKShareablePassMetadataPreview {}
);

#[cfg(feature = "PKAddSecureElementPassConfiguration")]
impl PKShareablePassMetadataPreview {
    extern_methods!(
        #[unsafe(method(initWithTemplateIdentifier:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTemplateIdentifier(
            this: Allocated<Self>,
            template_identifier: &NSString,
        ) -> Retained<Self>;

        #[unsafe(method(previewWithTemplateIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn previewWithTemplateIdentifier(
            template_identifier: &NSString,
        ) -> Retained<Self>;

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

        /// Setter for [`ownerDisplayName`][Self::ownerDisplayName].
        #[unsafe(method(setOwnerDisplayName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setOwnerDisplayName(&self, owner_display_name: Option<&NSString>);

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

/// Methods declared on superclass `PKAddPassMetadataPreview`.
#[cfg(feature = "PKAddSecureElementPassConfiguration")]
impl PKShareablePassMetadataPreview {
    extern_methods!(
        #[cfg(feature = "objc2-core-graphics")]
        /// Initializer preview object to represent the pass being added to Wallet.which requires a CGImage of the pass's card art and a localized description.
        /// - Properties:
        /// - passThumbnail: CGImage representing the card artwork of the pass to be presented during provisioning.
        /// - localizedDescription: Localized description of the pass.
        #[unsafe(method(initWithPassThumbnail:localizedDescription:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPassThumbnail_localizedDescription(
            this: Allocated<Self>,
            pass_thumbnail: &CGImage,
            description: &NSString,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-core-graphics")]
        #[unsafe(method(previewWithPassThumbnail:localizedDescription:))]
        #[unsafe(method_family = none)]
        pub unsafe fn previewWithPassThumbnail_localizedDescription(
            pass_thumbnail: &CGImage,
            description: &NSString,
        ) -> Retained<Self>;

        #[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>;
    );
}

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

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

impl PKShareablePassMetadata {
    extern_methods!(
        #[cfg(feature = "objc2-core-graphics")]
        #[deprecated = "Use initWithProvisioningCredentialIdentifier:sharingInstanceIdentifier:cardConfigurationIdentifier:passPreviewMetadata:"]
        #[unsafe(method(initWithProvisioningCredentialIdentifier:cardConfigurationIdentifier:sharingInstanceIdentifier:passThumbnailImage:ownerDisplayName:localizedDescription:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithProvisioningCredentialIdentifier_cardConfigurationIdentifier_sharingInstanceIdentifier_passThumbnailImage_ownerDisplayName_localizedDescription(
            this: Allocated<Self>,
            credential_identifier: &NSString,
            card_configuration_identifier: &NSString,
            sharing_instance_identifier: &NSString,
            pass_thumbnail_image: &CGImage,
            owner_display_name: &NSString,
            localized_description: &NSString,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "objc2-core-graphics")]
        #[deprecated = "Use initWithProvisioningCredentialIdentifier:sharingInstanceIdentifier:cardTemplateIdentifier:passPreviewMetadata:"]
        #[unsafe(method(initWithProvisioningCredentialIdentifier:sharingInstanceIdentifier:passThumbnailImage:ownerDisplayName:localizedDescription:accountHash:templateIdentifier:relyingPartyIdentifier:requiresUnifiedAccessCapableDevice:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithProvisioningCredentialIdentifier_sharingInstanceIdentifier_passThumbnailImage_ownerDisplayName_localizedDescription_accountHash_templateIdentifier_relyingPartyIdentifier_requiresUnifiedAccessCapableDevice(
            this: Allocated<Self>,
            credential_identifier: &NSString,
            sharing_instance_identifier: &NSString,
            pass_thumbnail_image: &CGImage,
            owner_display_name: &NSString,
            localized_description: &NSString,
            account_hash: &NSString,
            template_identifier: &NSString,
            relying_party_identifier: &NSString,
            requires_unified_access_capable_device: bool,
        ) -> Retained<Self>;

        #[cfg(feature = "PKAddSecureElementPassConfiguration")]
        #[unsafe(method(initWithProvisioningCredentialIdentifier:sharingInstanceIdentifier:cardTemplateIdentifier:preview:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithProvisioningCredentialIdentifier_sharingInstanceIdentifier_cardTemplateIdentifier_preview(
            this: Allocated<Self>,
            credential_identifier: &NSString,
            sharing_instance_identifier: &NSString,
            template_identifier: &NSString,
            preview: &PKShareablePassMetadataPreview,
        ) -> Retained<Self>;

        #[cfg(feature = "PKAddSecureElementPassConfiguration")]
        #[unsafe(method(initWithProvisioningCredentialIdentifier:sharingInstanceIdentifier:cardConfigurationIdentifier:preview:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithProvisioningCredentialIdentifier_sharingInstanceIdentifier_cardConfigurationIdentifier_preview(
            this: Allocated<Self>,
            credential_identifier: &NSString,
            sharing_instance_identifier: &NSString,
            template_identifier: &NSString,
            preview: &PKShareablePassMetadataPreview,
        ) -> Retained<Self>;

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

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

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

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

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

        #[unsafe(method(requiresUnifiedAccessCapableDevice))]
        #[unsafe(method_family = none)]
        pub unsafe fn requiresUnifiedAccessCapableDevice(&self) -> bool;

        /// Setter for [`requiresUnifiedAccessCapableDevice`][Self::requiresUnifiedAccessCapableDevice].
        #[unsafe(method(setRequiresUnifiedAccessCapableDevice:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRequiresUnifiedAccessCapableDevice(
            &self,
            requires_unified_access_capable_device: bool,
        );

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

        /// Setter for [`serverEnvironmentIdentifier`][Self::serverEnvironmentIdentifier].
        #[unsafe(method(setServerEnvironmentIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setServerEnvironmentIdentifier(
            &self,
            server_environment_identifier: &NSString,
        );

        #[cfg(feature = "PKAddSecureElementPassConfiguration")]
        #[unsafe(method(preview))]
        #[unsafe(method_family = none)]
        pub unsafe fn preview(&self) -> Retained<PKShareablePassMetadataPreview>;

        #[cfg(feature = "objc2-core-graphics")]
        #[deprecated]
        #[unsafe(method(passThumbnailImage))]
        #[unsafe(method_family = none)]
        pub unsafe fn passThumbnailImage(&self) -> Retained<CGImage>;

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

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

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

        /// Setter for [`accountHash`][Self::accountHash].
        #[unsafe(method(setAccountHash:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAccountHash(&self, account_hash: &NSString);

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

        /// Setter for [`relyingPartyIdentifier`][Self::relyingPartyIdentifier].
        #[unsafe(method(setRelyingPartyIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRelyingPartyIdentifier(&self, relying_party_identifier: &NSString);
    );
}

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

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

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

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

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

#[cfg(feature = "PKAddSecureElementPassConfiguration")]
extern_conformance!(
    unsafe impl NSObjectProtocol for PKAddShareablePassConfiguration {}
);

#[cfg(feature = "PKAddSecureElementPassConfiguration")]
impl PKAddShareablePassConfiguration {
    extern_methods!(
        #[cfg(feature = "block2")]
        #[deprecated = "Use configurationForPassMetadata:primaryAction:completion:"]
        #[unsafe(method(configurationForPassMetadata:provisioningPolicyIdentifier:primaryAction:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn configurationForPassMetadata_provisioningPolicyIdentifier_primaryAction_completion(
            pass_metadata: &NSArray<PKShareablePassMetadata>,
            provisioning_policy_identifier: &NSString,
            action: PKAddShareablePassConfigurationPrimaryAction,
            completion: &block2::DynBlock<
                dyn Fn(*mut PKAddShareablePassConfiguration, *mut NSError),
            >,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(configurationForPassMetadata:primaryAction:completion:))]
        #[unsafe(method_family = none)]
        pub unsafe fn configurationForPassMetadata_primaryAction_completion(
            pass_metadata: &NSArray<PKShareablePassMetadata>,
            action: PKAddShareablePassConfigurationPrimaryAction,
            completion: &block2::DynBlock<
                dyn Fn(*mut PKAddShareablePassConfiguration, *mut NSError),
            >,
        );

        #[unsafe(method(primaryAction))]
        #[unsafe(method_family = none)]
        pub unsafe fn primaryAction(&self) -> PKAddShareablePassConfigurationPrimaryAction;

        #[unsafe(method(credentialsMetadata))]
        #[unsafe(method_family = none)]
        pub unsafe fn credentialsMetadata(&self) -> Retained<NSArray<PKShareablePassMetadata>>;

        #[deprecated = "provisioningPolicyIdentifier has been deprecated. You can stop setting this property in the init with no repercussions."]
        #[unsafe(method(provisioningPolicyIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn provisioningPolicyIdentifier(&self) -> Retained<NSString>;
    );
}

/// Methods declared on superclass `PKAddSecureElementPassConfiguration`.
#[cfg(feature = "PKAddSecureElementPassConfiguration")]
impl PKAddShareablePassConfiguration {
    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>;
    );
}