//! 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_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsfetchindexdescription?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSFetchIndexDescription;
);

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

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

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

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

impl NSFetchIndexDescription {
    extern_methods!(
        #[cfg(feature = "NSFetchIndexElementDescription")]
        #[unsafe(method(initWithName:elements:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithName_elements(
            this: Allocated<Self>,
            name: &NSString,
            elements: Option<&NSArray<NSFetchIndexElementDescription>>,
        ) -> Retained<Self>;

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

        /// Setter for [`name`][Self::name].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setName(&self, name: &NSString);

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

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

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

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

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

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