//! 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/appkit/nstreenode?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSTreeNode;
);

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

impl NSTreeNode {
    extern_methods!(
        #[unsafe(method(treeNodeWithRepresentedObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn treeNodeWithRepresentedObject(
            model_object: Option<&AnyObject>,
        ) -> Retained<Self>;

        #[unsafe(method(initWithRepresentedObject:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithRepresentedObject(
            this: Allocated<Self>,
            model_object: Option<&AnyObject>,
        ) -> Retained<Self>;

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

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

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

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

        #[unsafe(method(mutableChildNodes))]
        #[unsafe(method_family = none)]
        pub unsafe fn mutableChildNodes(&self) -> Retained<NSMutableArray<NSTreeNode>>;

        #[unsafe(method(descendantNodeAtIndexPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn descendantNodeAtIndexPath(
            &self,
            index_path: &NSIndexPath,
        ) -> Option<Retained<NSTreeNode>>;

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

        #[unsafe(method(sortWithSortDescriptors:recursively:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sortWithSortDescriptors_recursively(
            &self,
            sort_descriptors: &NSArray<NSSortDescriptor>,
            recursively: bool,
        );
    );
}

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