//! 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/uikit/nsdiffabledatasourcesectionsnapshot?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSDiffableDataSourceSectionSnapshot<ItemIdentifierType: ?Sized = AnyObject>;
);

impl<ItemIdentifierType: ?Sized + Message> NSDiffableDataSourceSectionSnapshot<ItemIdentifierType> {
    /// Unchecked conversion of the generic parameter.
    ///
    /// # Safety
    ///
    /// The generic must be valid to reinterpret as the given type.
    #[inline]
    pub unsafe fn cast_unchecked<NewItemIdentifierType: ?Sized + Message>(
        &self,
    ) -> &NSDiffableDataSourceSectionSnapshot<NewItemIdentifierType> {
        unsafe { &*((self as *const Self).cast()) }
    }
}

extern_conformance!(
    unsafe impl<ItemIdentifierType: ?Sized> NSCopying
        for NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>
    {
    }
);

unsafe impl<ItemIdentifierType: ?Sized + Message> CopyingHelper
    for NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>
{
    type Result = Self;
}

extern_conformance!(
    unsafe impl<ItemIdentifierType: ?Sized> NSObjectProtocol
        for NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>
    {
    }
);

impl<ItemIdentifierType: Message> NSDiffableDataSourceSectionSnapshot<ItemIdentifierType> {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(appendItems:))]
        #[unsafe(method_family = none)]
        pub fn appendItems(&self, items: &NSArray<ItemIdentifierType>);

        #[unsafe(method(appendItems:intoParentItem:))]
        #[unsafe(method_family = none)]
        pub fn appendItems_intoParentItem(
            &self,
            items: &NSArray<ItemIdentifierType>,
            parent_item: Option<&ItemIdentifierType>,
        );

        #[unsafe(method(insertItems:beforeItem:))]
        #[unsafe(method_family = none)]
        pub fn insertItems_beforeItem(
            &self,
            items: &NSArray<ItemIdentifierType>,
            before_identifier: &ItemIdentifierType,
        );

        #[unsafe(method(insertItems:afterItem:))]
        #[unsafe(method_family = none)]
        pub fn insertItems_afterItem(
            &self,
            items: &NSArray<ItemIdentifierType>,
            after_identifier: &ItemIdentifierType,
        );

        #[unsafe(method(deleteItems:))]
        #[unsafe(method_family = none)]
        pub fn deleteItems(&self, items: &NSArray<ItemIdentifierType>);

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

        #[unsafe(method(expandItems:))]
        #[unsafe(method_family = none)]
        pub fn expandItems(&self, items: &NSArray<ItemIdentifierType>);

        #[unsafe(method(collapseItems:))]
        #[unsafe(method_family = none)]
        pub fn collapseItems(&self, items: &NSArray<ItemIdentifierType>);

        #[unsafe(method(replaceChildrenOfParentItem:withSnapshot:))]
        #[unsafe(method_family = none)]
        pub fn replaceChildrenOfParentItem_withSnapshot(
            &self,
            parent_item: &ItemIdentifierType,
            snapshot: &NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>,
        );

        #[unsafe(method(insertSnapshot:beforeItem:))]
        #[unsafe(method_family = none)]
        pub fn insertSnapshot_beforeItem(
            &self,
            snapshot: &NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>,
            item: &ItemIdentifierType,
        );

        #[unsafe(method(insertSnapshot:afterItem:))]
        #[unsafe(method_family = none)]
        pub fn insertSnapshot_afterItem(
            &self,
            snapshot: &NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>,
            item: &ItemIdentifierType,
        ) -> Retained<ItemIdentifierType>;

        #[unsafe(method(isExpanded:))]
        #[unsafe(method_family = none)]
        pub fn isExpanded(&self, item: &ItemIdentifierType) -> bool;

        #[unsafe(method(isVisible:))]
        #[unsafe(method_family = none)]
        pub fn isVisible(&self, item: &ItemIdentifierType) -> bool;

        #[unsafe(method(containsItem:))]
        #[unsafe(method_family = none)]
        pub fn containsItem(&self, item: &ItemIdentifierType) -> bool;

        #[unsafe(method(levelOfItem:))]
        #[unsafe(method_family = none)]
        pub fn levelOfItem(&self, item: &ItemIdentifierType) -> NSInteger;

        #[unsafe(method(indexOfItem:))]
        #[unsafe(method_family = none)]
        pub fn indexOfItem(&self, item: &ItemIdentifierType) -> NSInteger;

        #[unsafe(method(expandedItems))]
        #[unsafe(method_family = none)]
        pub fn expandedItems(&self) -> Retained<NSArray<ItemIdentifierType>>;

        #[unsafe(method(parentOfChildItem:))]
        #[unsafe(method_family = none)]
        pub fn parentOfChildItem(
            &self,
            child_item: &ItemIdentifierType,
        ) -> Option<Retained<ItemIdentifierType>>;

        #[unsafe(method(snapshotOfParentItem:))]
        #[unsafe(method_family = none)]
        pub fn snapshotOfParentItem(
            &self,
            parent_item: &ItemIdentifierType,
        ) -> Retained<NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>>;

        #[unsafe(method(snapshotOfParentItem:includingParentItem:))]
        #[unsafe(method_family = none)]
        pub fn snapshotOfParentItem_includingParentItem(
            &self,
            parent_item: &ItemIdentifierType,
            including_parent_item: bool,
        ) -> Retained<NSDiffableDataSourceSectionSnapshot<ItemIdentifierType>>;

        #[unsafe(method(rootItems))]
        #[unsafe(method_family = none)]
        pub fn rootItems(&self) -> Retained<NSArray<ItemIdentifierType>>;

        #[unsafe(method(visibleItems))]
        #[unsafe(method_family = none)]
        pub fn visibleItems(&self) -> Retained<NSArray<ItemIdentifierType>>;

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

/// Methods declared on superclass `NSObject`.
impl<ItemIdentifierType: Message> NSDiffableDataSourceSectionSnapshot<ItemIdentifierType> {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub fn new() -> Retained<Self>;
    );
}

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