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

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSIndexSet {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCopying for NSIndexSet {}
);

#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSIndexSet {
    type Result = Self;
}

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSMutableCopying for NSIndexSet {}
);

#[cfg(feature = "NSObject")]
unsafe impl MutableCopyingHelper for NSIndexSet {
    type Result = NSMutableIndexSet;
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSSecureCoding for NSIndexSet {}
);

impl NSIndexSet {
    extern_methods!(
        #[unsafe(method(indexSet))]
        #[unsafe(method_family = none)]
        pub fn indexSet() -> Retained<Self>;

        #[unsafe(method(indexSetWithIndex:))]
        #[unsafe(method_family = none)]
        pub fn indexSetWithIndex(value: NSUInteger) -> Retained<Self>;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(indexSetWithIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub fn indexSetWithIndexesInRange(range: NSRange) -> Retained<Self>;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(initWithIndexesInRange:))]
        #[unsafe(method_family = init)]
        pub fn initWithIndexesInRange(this: Allocated<Self>, range: NSRange) -> Retained<Self>;

        #[unsafe(method(initWithIndexSet:))]
        #[unsafe(method_family = init)]
        pub fn initWithIndexSet(this: Allocated<Self>, index_set: &NSIndexSet) -> Retained<Self>;

        #[unsafe(method(initWithIndex:))]
        #[unsafe(method_family = init)]
        pub fn initWithIndex(this: Allocated<Self>, value: NSUInteger) -> Retained<Self>;

        #[unsafe(method(isEqualToIndexSet:))]
        #[unsafe(method_family = none)]
        pub fn isEqualToIndexSet(&self, index_set: &NSIndexSet) -> bool;

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

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

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

        #[unsafe(method(indexGreaterThanIndex:))]
        #[unsafe(method_family = none)]
        pub fn indexGreaterThanIndex(&self, value: NSUInteger) -> NSUInteger;

        #[unsafe(method(indexLessThanIndex:))]
        #[unsafe(method_family = none)]
        pub fn indexLessThanIndex(&self, value: NSUInteger) -> NSUInteger;

        #[unsafe(method(indexGreaterThanOrEqualToIndex:))]
        #[unsafe(method_family = none)]
        pub fn indexGreaterThanOrEqualToIndex(&self, value: NSUInteger) -> NSUInteger;

        #[unsafe(method(indexLessThanOrEqualToIndex:))]
        #[unsafe(method_family = none)]
        pub fn indexLessThanOrEqualToIndex(&self, value: NSUInteger) -> NSUInteger;

        #[cfg(feature = "NSRange")]
        /// # Safety
        ///
        /// - `index_buffer` must be a valid pointer.
        /// - `range` must be a valid pointer or null.
        #[unsafe(method(getIndexes:maxCount:inIndexRange:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getIndexes_maxCount_inIndexRange(
            &self,
            index_buffer: NonNull<NSUInteger>,
            buffer_size: NSUInteger,
            range: NSRangePointer,
        ) -> NSUInteger;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(countOfIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub fn countOfIndexesInRange(&self, range: NSRange) -> NSUInteger;

        #[unsafe(method(containsIndex:))]
        #[unsafe(method_family = none)]
        pub fn containsIndex(&self, value: NSUInteger) -> bool;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(containsIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub fn containsIndexesInRange(&self, range: NSRange) -> bool;

        #[unsafe(method(containsIndexes:))]
        #[unsafe(method_family = none)]
        pub fn containsIndexes(&self, index_set: &NSIndexSet) -> bool;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(intersectsIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub fn intersectsIndexesInRange(&self, range: NSRange) -> bool;

        #[cfg(feature = "block2")]
        #[unsafe(method(enumerateIndexesUsingBlock:))]
        #[unsafe(method_family = none)]
        pub fn enumerateIndexesUsingBlock(
            &self,
            block: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(enumerateIndexesWithOptions:usingBlock:))]
        #[unsafe(method_family = none)]
        pub fn enumerateIndexesWithOptions_usingBlock(
            &self,
            opts: NSEnumerationOptions,
            block: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(enumerateIndexesInRange:options:usingBlock:))]
        #[unsafe(method_family = none)]
        pub fn enumerateIndexesInRange_options_usingBlock(
            &self,
            range: NSRange,
            opts: NSEnumerationOptions,
            block: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) + '_>,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(indexPassingTest:))]
        #[unsafe(method_family = none)]
        pub fn indexPassingTest(
            &self,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> NSUInteger;

        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(indexWithOptions:passingTest:))]
        #[unsafe(method_family = none)]
        pub fn indexWithOptions_passingTest(
            &self,
            opts: NSEnumerationOptions,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> NSUInteger;

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(indexInRange:options:passingTest:))]
        #[unsafe(method_family = none)]
        pub fn indexInRange_options_passingTest(
            &self,
            range: NSRange,
            opts: NSEnumerationOptions,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> NSUInteger;

        #[cfg(feature = "block2")]
        #[unsafe(method(indexesPassingTest:))]
        #[unsafe(method_family = none)]
        pub fn indexesPassingTest(
            &self,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> Retained<NSIndexSet>;

        #[cfg(all(feature = "NSObjCRuntime", feature = "block2"))]
        #[unsafe(method(indexesWithOptions:passingTest:))]
        #[unsafe(method_family = none)]
        pub fn indexesWithOptions_passingTest(
            &self,
            opts: NSEnumerationOptions,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> Retained<NSIndexSet>;

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(indexesInRange:options:passingTest:))]
        #[unsafe(method_family = none)]
        pub fn indexesInRange_options_passingTest(
            &self,
            range: NSRange,
            opts: NSEnumerationOptions,
            predicate: &block2::DynBlock<dyn Fn(NSUInteger, NonNull<Bool>) -> Bool + '_>,
        ) -> Retained<NSIndexSet>;

        #[cfg(all(feature = "NSRange", feature = "block2"))]
        #[unsafe(method(enumerateRangesUsingBlock:))]
        #[unsafe(method_family = none)]
        pub fn enumerateRangesUsingBlock(
            &self,
            block: &block2::DynBlock<dyn Fn(NSRange, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(enumerateRangesWithOptions:usingBlock:))]
        #[unsafe(method_family = none)]
        pub fn enumerateRangesWithOptions_usingBlock(
            &self,
            opts: NSEnumerationOptions,
            block: &block2::DynBlock<dyn Fn(NSRange, NonNull<Bool>) + '_>,
        );

        #[cfg(all(feature = "NSObjCRuntime", feature = "NSRange", feature = "block2"))]
        #[unsafe(method(enumerateRangesInRange:options:usingBlock:))]
        #[unsafe(method_family = none)]
        pub fn enumerateRangesInRange_options_usingBlock(
            &self,
            range: NSRange,
            opts: NSEnumerationOptions,
            block: &block2::DynBlock<dyn Fn(NSRange, NonNull<Bool>) + '_>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl NSIndexSet {
    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 NSIndexSet {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSMutableIndexSet {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCopying for NSMutableIndexSet {}
);

#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSMutableIndexSet {
    type Result = NSIndexSet;
}

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSMutableCopying for NSMutableIndexSet {}
);

#[cfg(feature = "NSObject")]
unsafe impl MutableCopyingHelper for NSMutableIndexSet {
    type Result = Self;
}

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

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSSecureCoding for NSMutableIndexSet {}
);

impl NSMutableIndexSet {
    extern_methods!(
        #[unsafe(method(addIndexes:))]
        #[unsafe(method_family = none)]
        pub fn addIndexes(&self, index_set: &NSIndexSet);

        #[unsafe(method(removeIndexes:))]
        #[unsafe(method_family = none)]
        pub fn removeIndexes(&self, index_set: &NSIndexSet);

        #[unsafe(method(removeAllIndexes))]
        #[unsafe(method_family = none)]
        pub fn removeAllIndexes(&self);

        #[unsafe(method(addIndex:))]
        #[unsafe(method_family = none)]
        pub fn addIndex(&self, value: NSUInteger);

        #[unsafe(method(removeIndex:))]
        #[unsafe(method_family = none)]
        pub fn removeIndex(&self, value: NSUInteger);

        #[cfg(feature = "NSRange")]
        #[unsafe(method(addIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub fn addIndexesInRange(&self, range: NSRange);

        #[cfg(feature = "NSRange")]
        #[unsafe(method(removeIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub fn removeIndexesInRange(&self, range: NSRange);

        #[unsafe(method(shiftIndexesStartingAtIndex:by:))]
        #[unsafe(method_family = none)]
        pub fn shiftIndexesStartingAtIndex_by(&self, index: NSUInteger, delta: NSInteger);
    );
}

/// Methods declared on superclass `NSIndexSet`.
impl NSMutableIndexSet {
    extern_methods!(
        #[unsafe(method(indexSet))]
        #[unsafe(method_family = none)]
        pub fn indexSet() -> Retained<Self>;

        #[unsafe(method(indexSetWithIndex:))]
        #[unsafe(method_family = none)]
        pub fn indexSetWithIndex(value: NSUInteger) -> Retained<Self>;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(indexSetWithIndexesInRange:))]
        #[unsafe(method_family = none)]
        pub fn indexSetWithIndexesInRange(range: NSRange) -> Retained<Self>;

        #[cfg(feature = "NSRange")]
        #[unsafe(method(initWithIndexesInRange:))]
        #[unsafe(method_family = init)]
        pub fn initWithIndexesInRange(this: Allocated<Self>, range: NSRange) -> Retained<Self>;

        #[unsafe(method(initWithIndexSet:))]
        #[unsafe(method_family = init)]
        pub fn initWithIndexSet(this: Allocated<Self>, index_set: &NSIndexSet) -> Retained<Self>;

        #[unsafe(method(initWithIndex:))]
        #[unsafe(method_family = init)]
        pub fn initWithIndex(this: Allocated<Self>, value: NSUInteger) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSMutableIndexSet {
    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 NSMutableIndexSet {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
