use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CNContactType(pub NSInteger);
impl CNContactType {
#[doc(alias = "CNContactTypePerson")]
pub const Person: Self = Self(0);
#[doc(alias = "CNContactTypeOrganization")]
pub const Organization: Self = Self(1);
}
unsafe impl Encode for CNContactType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for CNContactType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CNContactSortOrder(pub NSInteger);
impl CNContactSortOrder {
#[doc(alias = "CNContactSortOrderNone")]
pub const None: Self = Self(0);
#[doc(alias = "CNContactSortOrderUserDefault")]
pub const UserDefault: Self = Self(1);
#[doc(alias = "CNContactSortOrderGivenName")]
pub const GivenName: Self = Self(2);
#[doc(alias = "CNContactSortOrderFamilyName")]
pub const FamilyName: Self = Self(3);
}
unsafe impl Encode for CNContactSortOrder {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for CNContactSortOrder {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait CNKeyDescriptor: NSObjectProtocol + NSSecureCoding + NSCopying {}
);
extern_conformance!(
unsafe impl CNKeyDescriptor for NSString {}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct CNContact;
);
extern_conformance!(
unsafe impl NSCoding for CNContact {}
);
extern_conformance!(
unsafe impl NSCopying for CNContact {}
);
unsafe impl CopyingHelper for CNContact {
type Result = Self;
}
extern_conformance!(
unsafe impl NSMutableCopying for CNContact {}
);
#[cfg(feature = "CNMutableContact")]
unsafe impl MutableCopyingHelper for CNContact {
type Result = CNMutableContact;
}
extern_conformance!(
unsafe impl NSObjectProtocol for CNContact {}
);
extern_conformance!(
unsafe impl NSSecureCoding for CNContact {}
);
impl CNContact {
extern_methods!(
#[unsafe(method(identifier))]
#[unsafe(method_family = none)]
pub unsafe fn identifier(&self) -> Retained<NSString>;
#[unsafe(method(contactType))]
#[unsafe(method_family = none)]
pub unsafe fn contactType(&self) -> CNContactType;
#[unsafe(method(namePrefix))]
#[unsafe(method_family = none)]
pub unsafe fn namePrefix(&self) -> Retained<NSString>;
#[unsafe(method(givenName))]
#[unsafe(method_family = none)]
pub unsafe fn givenName(&self) -> Retained<NSString>;
#[unsafe(method(middleName))]
#[unsafe(method_family = none)]
pub unsafe fn middleName(&self) -> Retained<NSString>;
#[unsafe(method(familyName))]
#[unsafe(method_family = none)]
pub unsafe fn familyName(&self) -> Retained<NSString>;
#[unsafe(method(previousFamilyName))]
#[unsafe(method_family = none)]
pub unsafe fn previousFamilyName(&self) -> Retained<NSString>;
#[unsafe(method(nameSuffix))]
#[unsafe(method_family = none)]
pub unsafe fn nameSuffix(&self) -> Retained<NSString>;
#[unsafe(method(nickname))]
#[unsafe(method_family = none)]
pub unsafe fn nickname(&self) -> Retained<NSString>;
#[unsafe(method(organizationName))]
#[unsafe(method_family = none)]
pub unsafe fn organizationName(&self) -> Retained<NSString>;
#[unsafe(method(departmentName))]
#[unsafe(method_family = none)]
pub unsafe fn departmentName(&self) -> Retained<NSString>;
#[unsafe(method(jobTitle))]
#[unsafe(method_family = none)]
pub unsafe fn jobTitle(&self) -> Retained<NSString>;
#[unsafe(method(phoneticGivenName))]
#[unsafe(method_family = none)]
pub unsafe fn phoneticGivenName(&self) -> Retained<NSString>;
#[unsafe(method(phoneticMiddleName))]
#[unsafe(method_family = none)]
pub unsafe fn phoneticMiddleName(&self) -> Retained<NSString>;
#[unsafe(method(phoneticFamilyName))]
#[unsafe(method_family = none)]
pub unsafe fn phoneticFamilyName(&self) -> Retained<NSString>;
#[unsafe(method(phoneticOrganizationName))]
#[unsafe(method_family = none)]
pub unsafe fn phoneticOrganizationName(&self) -> Retained<NSString>;
#[unsafe(method(note))]
#[unsafe(method_family = none)]
pub unsafe fn note(&self) -> Retained<NSString>;
#[unsafe(method(imageData))]
#[unsafe(method_family = none)]
pub unsafe fn imageData(&self) -> Option<Retained<NSData>>;
#[unsafe(method(thumbnailImageData))]
#[unsafe(method_family = none)]
pub unsafe fn thumbnailImageData(&self) -> Option<Retained<NSData>>;
#[unsafe(method(imageDataAvailable))]
#[unsafe(method_family = none)]
pub unsafe fn imageDataAvailable(&self) -> bool;
#[cfg(all(feature = "CNLabeledValue", feature = "CNPhoneNumber"))]
#[unsafe(method(phoneNumbers))]
#[unsafe(method_family = none)]
pub unsafe fn phoneNumbers(&self) -> Retained<NSArray<CNLabeledValue<CNPhoneNumber>>>;
#[cfg(feature = "CNLabeledValue")]
#[unsafe(method(emailAddresses))]
#[unsafe(method_family = none)]
pub unsafe fn emailAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;
#[cfg(all(feature = "CNLabeledValue", feature = "CNPostalAddress"))]
#[unsafe(method(postalAddresses))]
#[unsafe(method_family = none)]
pub unsafe fn postalAddresses(&self) -> Retained<NSArray<CNLabeledValue<CNPostalAddress>>>;
#[cfg(feature = "CNLabeledValue")]
#[unsafe(method(urlAddresses))]
#[unsafe(method_family = none)]
pub unsafe fn urlAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;
#[cfg(all(feature = "CNContactRelation", feature = "CNLabeledValue"))]
#[unsafe(method(contactRelations))]
#[unsafe(method_family = none)]
pub unsafe fn contactRelations(
&self,
) -> Retained<NSArray<CNLabeledValue<CNContactRelation>>>;
#[cfg(all(feature = "CNLabeledValue", feature = "CNSocialProfile"))]
#[unsafe(method(socialProfiles))]
#[unsafe(method_family = none)]
pub unsafe fn socialProfiles(&self) -> Retained<NSArray<CNLabeledValue<CNSocialProfile>>>;
#[cfg(all(feature = "CNInstantMessageAddress", feature = "CNLabeledValue"))]
#[unsafe(method(instantMessageAddresses))]
#[unsafe(method_family = none)]
pub unsafe fn instantMessageAddresses(
&self,
) -> Retained<NSArray<CNLabeledValue<CNInstantMessageAddress>>>;
#[unsafe(method(birthday))]
#[unsafe(method_family = none)]
pub unsafe fn birthday(&self) -> Option<Retained<NSDateComponents>>;
#[unsafe(method(nonGregorianBirthday))]
#[unsafe(method_family = none)]
pub unsafe fn nonGregorianBirthday(&self) -> Option<Retained<NSDateComponents>>;
#[cfg(feature = "CNLabeledValue")]
#[unsafe(method(dates))]
#[unsafe(method_family = none)]
pub unsafe fn dates(&self) -> Retained<NSArray<CNLabeledValue<NSDateComponents>>>;
#[unsafe(method(isKeyAvailable:))]
#[unsafe(method_family = none)]
pub unsafe fn isKeyAvailable(&self, key: &NSString) -> bool;
#[unsafe(method(areKeysAvailable:))]
#[unsafe(method_family = none)]
pub unsafe fn areKeysAvailable(
&self,
key_descriptors: &NSArray<ProtocolObject<dyn CNKeyDescriptor>>,
) -> bool;
#[unsafe(method(localizedStringForKey:))]
#[unsafe(method_family = none)]
pub unsafe fn localizedStringForKey(key: &NSString) -> Retained<NSString>;
#[unsafe(method(comparatorForNameSortOrder:))]
#[unsafe(method_family = none)]
pub unsafe fn comparatorForNameSortOrder(sort_order: CNContactSortOrder) -> NSComparator;
#[unsafe(method(descriptorForAllComparatorKeys))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorForAllComparatorKeys(
) -> Retained<ProtocolObject<dyn CNKeyDescriptor>>;
#[unsafe(method(isUnifiedWithContactWithIdentifier:))]
#[unsafe(method_family = none)]
pub unsafe fn isUnifiedWithContactWithIdentifier(
&self,
contact_identifier: &NSString,
) -> bool;
);
}
impl CNContact {
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 "C" {
pub static CNContactPropertyNotFetchedExceptionName: &'static NSString;
}
extern "C" {
pub static CNContactIdentifierKey: &'static NSString;
}
extern "C" {
pub static CNContactNamePrefixKey: &'static NSString;
}
extern "C" {
pub static CNContactGivenNameKey: &'static NSString;
}
extern "C" {
pub static CNContactMiddleNameKey: &'static NSString;
}
extern "C" {
pub static CNContactFamilyNameKey: &'static NSString;
}
extern "C" {
pub static CNContactPreviousFamilyNameKey: &'static NSString;
}
extern "C" {
pub static CNContactNameSuffixKey: &'static NSString;
}
extern "C" {
pub static CNContactNicknameKey: &'static NSString;
}
extern "C" {
pub static CNContactOrganizationNameKey: &'static NSString;
}
extern "C" {
pub static CNContactDepartmentNameKey: &'static NSString;
}
extern "C" {
pub static CNContactJobTitleKey: &'static NSString;
}
extern "C" {
pub static CNContactPhoneticGivenNameKey: &'static NSString;
}
extern "C" {
pub static CNContactPhoneticMiddleNameKey: &'static NSString;
}
extern "C" {
pub static CNContactPhoneticFamilyNameKey: &'static NSString;
}
extern "C" {
pub static CNContactPhoneticOrganizationNameKey: &'static NSString;
}
extern "C" {
pub static CNContactBirthdayKey: &'static NSString;
}
extern "C" {
pub static CNContactNonGregorianBirthdayKey: &'static NSString;
}
extern "C" {
pub static CNContactNoteKey: &'static NSString;
}
extern "C" {
pub static CNContactImageDataKey: &'static NSString;
}
extern "C" {
pub static CNContactThumbnailImageDataKey: &'static NSString;
}
extern "C" {
pub static CNContactImageDataAvailableKey: &'static NSString;
}
extern "C" {
pub static CNContactTypeKey: &'static NSString;
}
extern "C" {
pub static CNContactPhoneNumbersKey: &'static NSString;
}
extern "C" {
pub static CNContactEmailAddressesKey: &'static NSString;
}
extern "C" {
pub static CNContactPostalAddressesKey: &'static NSString;
}
extern "C" {
pub static CNContactDatesKey: &'static NSString;
}
extern "C" {
pub static CNContactUrlAddressesKey: &'static NSString;
}
extern "C" {
pub static CNContactRelationsKey: &'static NSString;
}
extern "C" {
pub static CNContactSocialProfilesKey: &'static NSString;
}
extern "C" {
pub static CNContactInstantMessageAddressesKey: &'static NSString;
}