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

/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsfetchindexelementtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFetchIndexElementType(pub NSUInteger);
impl NSFetchIndexElementType {
    #[doc(alias = "NSFetchIndexElementTypeBinary")]
    pub const Binary: Self = Self(0);
    #[doc(alias = "NSFetchIndexElementTypeRTree")]
    pub const RTree: Self = Self(1);
}

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

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

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

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

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

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

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

impl NSFetchIndexElementDescription {
    extern_methods!(
        #[cfg(feature = "NSPropertyDescription")]
        #[unsafe(method(initWithProperty:collationType:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithProperty_collationType(
            this: Allocated<Self>,
            property: &NSPropertyDescription,
            collation_type: NSFetchIndexElementType,
        ) -> Retained<Self>;

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

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

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

        /// Setter for [`collationType`][Self::collationType].
        #[unsafe(method(setCollationType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCollationType(&self, collation_type: NSFetchIndexElementType);

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

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

        #[cfg(feature = "NSFetchIndexDescription")]
        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(indexDescription))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexDescription(&self) -> Option<Retained<NSFetchIndexDescription>>;
    );
}

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