//! 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 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);
}

// NS_ENUM
#[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: NSCopying + NSObjectProtocol + NSSecureCoding {}

    unsafe impl ProtocolType for dyn CNKeyDescriptor {}
);

unsafe impl CNKeyDescriptor for NSString {}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CNContact;

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

unsafe impl NSCoding for CNContact {}

unsafe impl NSCopying for CNContact {}

unsafe impl NSMutableCopying for CNContact {}

unsafe impl NSObjectProtocol for CNContact {}

unsafe impl NSSecureCoding for CNContact {}

extern_methods!(
    unsafe impl CNContact {
        #[method_id(@__retain_semantics Other identifier)]
        pub unsafe fn identifier(&self) -> Retained<NSString>;

        #[method(contactType)]
        pub unsafe fn contactType(&self) -> CNContactType;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        #[method(imageDataAvailable)]
        pub unsafe fn imageDataAvailable(&self) -> bool;

        #[cfg(all(feature = "CNLabeledValue", feature = "CNPhoneNumber"))]
        #[method_id(@__retain_semantics Other phoneNumbers)]
        pub unsafe fn phoneNumbers(&self) -> Retained<NSArray<CNLabeledValue<CNPhoneNumber>>>;

        #[cfg(feature = "CNLabeledValue")]
        #[method_id(@__retain_semantics Other emailAddresses)]
        pub unsafe fn emailAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;

        #[cfg(all(feature = "CNLabeledValue", feature = "CNPostalAddress"))]
        #[method_id(@__retain_semantics Other postalAddresses)]
        pub unsafe fn postalAddresses(&self) -> Retained<NSArray<CNLabeledValue<CNPostalAddress>>>;

        #[cfg(feature = "CNLabeledValue")]
        #[method_id(@__retain_semantics Other urlAddresses)]
        pub unsafe fn urlAddresses(&self) -> Retained<NSArray<CNLabeledValue<NSString>>>;

        #[cfg(all(feature = "CNContactRelation", feature = "CNLabeledValue"))]
        #[method_id(@__retain_semantics Other contactRelations)]
        pub unsafe fn contactRelations(
            &self,
        ) -> Retained<NSArray<CNLabeledValue<CNContactRelation>>>;

        #[cfg(all(feature = "CNLabeledValue", feature = "CNSocialProfile"))]
        #[method_id(@__retain_semantics Other socialProfiles)]
        pub unsafe fn socialProfiles(&self) -> Retained<NSArray<CNLabeledValue<CNSocialProfile>>>;

        #[cfg(all(feature = "CNInstantMessageAddress", feature = "CNLabeledValue"))]
        #[method_id(@__retain_semantics Other instantMessageAddresses)]
        pub unsafe fn instantMessageAddresses(
            &self,
        ) -> Retained<NSArray<CNLabeledValue<CNInstantMessageAddress>>>;

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

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

        #[cfg(feature = "CNLabeledValue")]
        #[method_id(@__retain_semantics Other dates)]
        pub unsafe fn dates(&self) -> Retained<NSArray<CNLabeledValue<NSDateComponents>>>;

        #[method(isKeyAvailable:)]
        pub unsafe fn isKeyAvailable(&self, key: &NSString) -> bool;

        #[method(areKeysAvailable:)]
        pub unsafe fn areKeysAvailable(
            &self,
            key_descriptors: &NSArray<ProtocolObject<dyn CNKeyDescriptor>>,
        ) -> bool;

        #[method_id(@__retain_semantics Other localizedStringForKey:)]
        pub unsafe fn localizedStringForKey(key: &NSString) -> Retained<NSString>;

        #[cfg(feature = "block2")]
        #[method(comparatorForNameSortOrder:)]
        pub unsafe fn comparatorForNameSortOrder(sort_order: CNContactSortOrder) -> NSComparator;

        #[method_id(@__retain_semantics Other descriptorForAllComparatorKeys)]
        pub unsafe fn descriptorForAllComparatorKeys(
        ) -> Retained<ProtocolObject<dyn CNKeyDescriptor>>;

        #[method(isUnifiedWithContactWithIdentifier:)]
        pub unsafe fn isUnifiedWithContactWithIdentifier(
            &self,
            contact_identifier: &NSString,
        ) -> bool;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl CNContact {
        #[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>;
    }
);

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;
}
