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::*;

extern_protocol!(
    /// "Descriptor" objects describe types of documents that can be requested. Different document
    /// types may have different sets of supported elements, functionality, or response formats.
    /// Clients should not define their own implementations of this protocol or subclass existing implementations.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/passkit/pkidentitydocumentdescriptor?language=objc)
    pub unsafe trait PKIdentityDocumentDescriptor: NSObjectProtocol {
        #[cfg(feature = "PKIdentityElement")]
        /// Set of elements that will be requested from the document.
        #[unsafe(method(elements))]
        #[unsafe(method_family = none)]
        unsafe fn elements(&self) -> Retained<NSArray<PKIdentityElement>>;

        #[cfg(all(feature = "PKIdentityElement", feature = "PKIdentityIntentToStore"))]
        /// Intent to store for the given element, or nil if the element has not been added to this descriptor.
        #[unsafe(method(intentToStoreForElement:))]
        #[unsafe(method_family = none)]
        unsafe fn intentToStoreForElement(
            &self,
            element: &PKIdentityElement,
        ) -> Option<Retained<PKIdentityIntentToStore>>;

        #[cfg(all(feature = "PKIdentityElement", feature = "PKIdentityIntentToStore"))]
        /// Adds the set of elements and associates them with the intent to store. This method can be
        /// called multple times with the same intent to store to append additional elements. If the same
        /// element is specified multiple times with different intents to store, the most recent one wins.
        #[unsafe(method(addElements:withIntentToStore:))]
        #[unsafe(method_family = none)]
        unsafe fn addElements_withIntentToStore(
            &self,
            elements: &NSArray<PKIdentityElement>,
            intent_to_store: &PKIdentityIntentToStore,
        );
    }
);

extern_class!(
    /// Used to request information from a user's driver's license (or equivalent document).
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/passkit/pkidentitydriverslicensedescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PKIdentityDriversLicenseDescriptor;
);

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

extern_conformance!(
    unsafe impl PKIdentityDocumentDescriptor for PKIdentityDriversLicenseDescriptor {}
);

impl PKIdentityDriversLicenseDescriptor {
    extern_methods!();
}

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

extern_class!(
    /// Used to request information from a user's national id card (or equivalent document).
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/passkit/pkidentitynationalidcarddescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PKIdentityNationalIDCardDescriptor;
);

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

extern_conformance!(
    unsafe impl PKIdentityDocumentDescriptor for PKIdentityNationalIDCardDescriptor {}
);

impl PKIdentityNationalIDCardDescriptor {
    extern_methods!(
        /// Alpha-2 country code, as defined in ISO 3166-1, of the issuing authority’s country or territory
        #[unsafe(method(regionCode))]
        #[unsafe(method_family = none)]
        pub unsafe fn regionCode(&self) -> Option<Retained<NSString>>;

        /// Setter for [`regionCode`][Self::regionCode].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setRegionCode:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setRegionCode(&self, region_code: Option<&NSString>);
    );
}

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

extern_class!(
    /// Used to request information from a user's photo ID (or equivalent document).
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/passkit/pkidentityphotoiddescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PKIdentityPhotoIDDescriptor;
);

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

extern_conformance!(
    unsafe impl PKIdentityDocumentDescriptor for PKIdentityPhotoIDDescriptor {}
);

impl PKIdentityPhotoIDDescriptor {
    extern_methods!();
}

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

extern_class!(
    /// Used to request information from multiple identity documents.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/passkit/pkidentityanyofdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct PKIdentityAnyOfDescriptor;
);

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

extern_conformance!(
    unsafe impl PKIdentityDocumentDescriptor for PKIdentityAnyOfDescriptor {}
);

impl PKIdentityAnyOfDescriptor {
    extern_methods!(
        /// Set of requested descriptors for the composite document descriptor.
        #[unsafe(method(descriptors))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptors(
            &self,
        ) -> Retained<NSArray<ProtocolObject<dyn PKIdentityDocumentDescriptor>>>;

        /// Returns a composite document descriptor with specified descriptors.
        #[unsafe(method(initWithDescriptors:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithDescriptors(
            this: Allocated<Self>,
            descriptors: &NSArray<ProtocolObject<dyn PKIdentityDocumentDescriptor>>,
        ) -> 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>;
    );
}