//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextlistelement?language=objc)
    #[unsafe(super(NSTextParagraph, NSTextElement, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSTextElement")]
    pub struct NSTextListElement;
);

#[cfg(feature = "NSTextElement")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSTextListElement {}
);

#[cfg(feature = "NSTextElement")]
impl NSTextListElement {
    extern_methods!(
        #[cfg(feature = "NSTextList")]
        /// # Safety
        ///
        /// `marker_attributes` generic should be of the correct type.
        #[unsafe(method(initWithParentElement:textList:contents:markerAttributes:childElements:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithParentElement_textList_contents_markerAttributes_childElements(
            this: Allocated<Self>,
            parent: Option<&NSTextListElement>,
            text_list: &NSTextList,
            contents: Option<&NSAttributedString>,
            marker_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
            children: Option<&NSArray<NSTextListElement>>,
        ) -> Retained<Self>;

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

        #[cfg(feature = "NSTextList")]
        /// # Safety
        ///
        /// `marker_attributes` generic should be of the correct type.
        #[unsafe(method(textListElementWithContents:markerAttributes:textList:childElements:))]
        #[unsafe(method_family = none)]
        pub unsafe fn textListElementWithContents_markerAttributes_textList_childElements(
            contents: &NSAttributedString,
            marker_attributes: Option<&NSDictionary<NSAttributedStringKey, AnyObject>>,
            text_list: &NSTextList,
            children: Option<&NSArray<NSTextListElement>>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSTextList")]
        #[unsafe(method(textListElementWithChildElements:textList:nestingLevel:))]
        #[unsafe(method_family = none)]
        pub fn textListElementWithChildElements_textList_nestingLevel(
            children: &NSArray<NSTextListElement>,
            text_list: &NSTextList,
            nesting_level: NSInteger,
        ) -> Option<Retained<Self>>;

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

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

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

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

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

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

/// Methods declared on superclass `NSTextElement`.
#[cfg(feature = "NSTextElement")]
impl NSTextListElement {
    extern_methods!(
        #[cfg(feature = "NSTextContentManager")]
        #[unsafe(method(initWithTextContentManager:))]
        #[unsafe(method_family = init)]
        pub fn initWithTextContentManager(
            this: Allocated<Self>,
            text_content_manager: Option<&NSTextContentManager>,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSTextElement")]
impl NSTextListElement {
    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>;
    );
}

#[cfg(feature = "NSTextElement")]
impl DefaultRetained for NSTextListElement {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
