//! 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-text")]
#[cfg(target_vendor = "apple")]
use objc2_core_text::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionvisibility?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontCollectionVisibility(pub NSUInteger);
bitflags::bitflags! {
    impl NSFontCollectionVisibility: NSUInteger {
        #[doc(alias = "NSFontCollectionVisibilityProcess")]
        const Process = 1<<0;
        #[doc(alias = "NSFontCollectionVisibilityUser")]
        const User = 1<<1;
        #[doc(alias = "NSFontCollectionVisibilityComputer")]
        const Computer = 1<<2;
    }
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionmatchingoptionkey?language=objc)
// NS_TYPED_ENUM
pub type NSFontCollectionMatchingOptionKey = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionincludedisabledfontsoption?language=objc)
    pub static NSFontCollectionIncludeDisabledFontsOption:
        &'static NSFontCollectionMatchingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionremoveduplicatesoption?language=objc)
    pub static NSFontCollectionRemoveDuplicatesOption: &'static NSFontCollectionMatchingOptionKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectiondisallowautoactivationoption?language=objc)
    pub static NSFontCollectionDisallowAutoActivationOption:
        &'static NSFontCollectionMatchingOptionKey;
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionname?language=objc)
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSFontCollectionName = NSString;

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

#[cfg(feature = "objc2-core-text")]
#[cfg(target_vendor = "apple")]
impl AsRef<NSFontCollection> for CTFontCollection {
    #[inline]
    fn as_ref(&self) -> &NSFontCollection {
        unsafe { &*((self as *const Self).cast()) }
    }
}

#[cfg(feature = "objc2-core-text")]
#[cfg(target_vendor = "apple")]
impl AsRef<CTFontCollection> for NSFontCollection {
    #[inline]
    fn as_ref(&self) -> &CTFontCollection {
        unsafe { &*((self as *const Self).cast()) }
    }
}

extern_conformance!(
    unsafe impl NSCoding for NSFontCollection {}
);

extern_conformance!(
    unsafe impl NSCopying for NSFontCollection {}
);

unsafe impl CopyingHelper for NSFontCollection {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSMutableCopying for NSFontCollection {}
);

unsafe impl MutableCopyingHelper for NSFontCollection {
    type Result = NSMutableFontCollection;
}

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

impl NSFontCollection {
    extern_methods!(
        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(fontCollectionWithDescriptors:))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithDescriptors(
            query_descriptors: &NSArray<NSFontDescriptor>,
        ) -> Retained<NSFontCollection>;

        #[unsafe(method(fontCollectionWithAllAvailableDescriptors))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithAllAvailableDescriptors() -> Retained<NSFontCollection>;

        #[unsafe(method(fontCollectionWithLocale:))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithLocale(locale: &NSLocale) -> Option<Retained<NSFontCollection>>;

        #[unsafe(method(showFontCollection:withName:visibility:error:_))]
        #[unsafe(method_family = none)]
        pub fn showFontCollection_withName_visibility_error(
            collection: &NSFontCollection,
            name: &NSFontCollectionName,
            visibility: NSFontCollectionVisibility,
        ) -> Result<(), Retained<NSError>>;

        #[unsafe(method(hideFontCollectionWithName:visibility:error:_))]
        #[unsafe(method_family = none)]
        pub fn hideFontCollectionWithName_visibility_error(
            name: &NSFontCollectionName,
            visibility: NSFontCollectionVisibility,
        ) -> Result<(), Retained<NSError>>;

        #[unsafe(method(renameFontCollectionWithName:visibility:toName:error:_))]
        #[unsafe(method_family = none)]
        pub fn renameFontCollectionWithName_visibility_toName_error(
            old_name: &NSFontCollectionName,
            visibility: NSFontCollectionVisibility,
            new_name: &NSFontCollectionName,
        ) -> Result<(), Retained<NSError>>;

        #[unsafe(method(allFontCollectionNames))]
        #[unsafe(method_family = none)]
        pub fn allFontCollectionNames() -> Retained<NSArray<NSFontCollectionName>>;

        #[unsafe(method(fontCollectionWithName:))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithName(
            name: &NSFontCollectionName,
        ) -> Option<Retained<NSFontCollection>>;

        #[unsafe(method(fontCollectionWithName:visibility:))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithName_visibility(
            name: &NSFontCollectionName,
            visibility: NSFontCollectionVisibility,
        ) -> Option<Retained<NSFontCollection>>;

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(queryDescriptors))]
        #[unsafe(method_family = none)]
        pub fn queryDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(exclusionDescriptors))]
        #[unsafe(method_family = none)]
        pub fn exclusionDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(matchingDescriptors))]
        #[unsafe(method_family = none)]
        pub fn matchingDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(matchingDescriptorsWithOptions:))]
        #[unsafe(method_family = none)]
        pub fn matchingDescriptorsWithOptions(
            &self,
            options: Option<&NSDictionary<NSFontCollectionMatchingOptionKey, NSNumber>>,
        ) -> Option<Retained<NSArray<NSFontDescriptor>>>;

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(matchingDescriptorsForFamily:))]
        #[unsafe(method_family = none)]
        pub fn matchingDescriptorsForFamily(
            &self,
            family: &NSString,
        ) -> Option<Retained<NSArray<NSFontDescriptor>>>;

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(matchingDescriptorsForFamily:options:))]
        #[unsafe(method_family = none)]
        pub fn matchingDescriptorsForFamily_options(
            &self,
            family: &NSString,
            options: Option<&NSDictionary<NSFontCollectionMatchingOptionKey, NSNumber>>,
        ) -> Option<Retained<NSArray<NSFontDescriptor>>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSFontCollection {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSFontCollection {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "objc2-core-text")]
#[cfg(target_vendor = "apple")]
impl AsRef<NSMutableFontCollection> for CTMutableFontCollection {
    #[inline]
    fn as_ref(&self) -> &NSMutableFontCollection {
        unsafe { &*((self as *const Self).cast()) }
    }
}

#[cfg(feature = "objc2-core-text")]
#[cfg(target_vendor = "apple")]
impl AsRef<CTMutableFontCollection> for NSMutableFontCollection {
    #[inline]
    fn as_ref(&self) -> &CTMutableFontCollection {
        unsafe { &*((self as *const Self).cast()) }
    }
}

extern_conformance!(
    unsafe impl NSCoding for NSMutableFontCollection {}
);

extern_conformance!(
    unsafe impl NSCopying for NSMutableFontCollection {}
);

unsafe impl CopyingHelper for NSMutableFontCollection {
    type Result = NSFontCollection;
}

extern_conformance!(
    unsafe impl NSMutableCopying for NSMutableFontCollection {}
);

unsafe impl MutableCopyingHelper for NSMutableFontCollection {
    type Result = Self;
}

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

impl NSMutableFontCollection {
    extern_methods!(
        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(fontCollectionWithDescriptors:))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithDescriptors(
            query_descriptors: &NSArray<NSFontDescriptor>,
        ) -> Retained<NSMutableFontCollection>;

        #[unsafe(method(fontCollectionWithAllAvailableDescriptors))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithAllAvailableDescriptors() -> Retained<NSMutableFontCollection>;

        #[unsafe(method(fontCollectionWithLocale:))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithLocale(locale: &NSLocale) -> Retained<NSMutableFontCollection>;

        #[unsafe(method(fontCollectionWithName:))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithName(
            name: &NSFontCollectionName,
        ) -> Option<Retained<NSMutableFontCollection>>;

        #[unsafe(method(fontCollectionWithName:visibility:))]
        #[unsafe(method_family = none)]
        pub fn fontCollectionWithName_visibility(
            name: &NSFontCollectionName,
            visibility: NSFontCollectionVisibility,
        ) -> Option<Retained<NSMutableFontCollection>>;

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(queryDescriptors))]
        #[unsafe(method_family = none)]
        pub fn queryDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;

        #[cfg(feature = "NSFontDescriptor")]
        /// Setter for [`queryDescriptors`][Self::queryDescriptors].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setQueryDescriptors:))]
        #[unsafe(method_family = none)]
        pub fn setQueryDescriptors(&self, query_descriptors: Option<&NSArray<NSFontDescriptor>>);

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(exclusionDescriptors))]
        #[unsafe(method_family = none)]
        pub fn exclusionDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;

        #[cfg(feature = "NSFontDescriptor")]
        /// Setter for [`exclusionDescriptors`][Self::exclusionDescriptors].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setExclusionDescriptors:))]
        #[unsafe(method_family = none)]
        pub fn setExclusionDescriptors(
            &self,
            exclusion_descriptors: Option<&NSArray<NSFontDescriptor>>,
        );

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(addQueryForDescriptors:))]
        #[unsafe(method_family = none)]
        pub fn addQueryForDescriptors(&self, descriptors: &NSArray<NSFontDescriptor>);

        #[cfg(feature = "NSFontDescriptor")]
        #[unsafe(method(removeQueryForDescriptors:))]
        #[unsafe(method_family = none)]
        pub fn removeQueryForDescriptors(&self, descriptors: &NSArray<NSFontDescriptor>);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSMutableFontCollection {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

impl DefaultRetained for NSMutableFontCollection {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectiondidchangenotification?language=objc)
    pub static NSFontCollectionDidChangeNotification: &'static NSNotificationName;
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionuserinfokey?language=objc)
// NS_TYPED_ENUM
pub type NSFontCollectionUserInfoKey = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionactionkey?language=objc)
    pub static NSFontCollectionActionKey: &'static NSFontCollectionUserInfoKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionnamekey?language=objc)
    pub static NSFontCollectionNameKey: &'static NSFontCollectionUserInfoKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionoldnamekey?language=objc)
    pub static NSFontCollectionOldNameKey: &'static NSFontCollectionUserInfoKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionvisibilitykey?language=objc)
    pub static NSFontCollectionVisibilityKey: &'static NSFontCollectionUserInfoKey;
}

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionactiontypekey?language=objc)
// NS_TYPED_ENUM
pub type NSFontCollectionActionTypeKey = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionwasshown?language=objc)
    pub static NSFontCollectionWasShown: &'static NSFontCollectionActionTypeKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionwashidden?language=objc)
    pub static NSFontCollectionWasHidden: &'static NSFontCollectionActionTypeKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionwasrenamed?language=objc)
    pub static NSFontCollectionWasRenamed: &'static NSFontCollectionActionTypeKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionallfonts?language=objc)
    pub static NSFontCollectionAllFonts: &'static NSFontCollectionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionuser?language=objc)
    pub static NSFontCollectionUser: &'static NSFontCollectionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionfavorites?language=objc)
    pub static NSFontCollectionFavorites: &'static NSFontCollectionName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsfontcollectionrecentlyused?language=objc)
    pub static NSFontCollectionRecentlyUsed: &'static NSFontCollectionName;
}
