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

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

impl NSTextElement {
    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>;

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

        #[cfg(feature = "NSTextContentManager")]
        /// Setter for [`textContentManager`][Self::textContentManager].
        ///
        /// This is a [weak property][objc2::topics::weak_property].
        #[unsafe(method(setTextContentManager:))]
        #[unsafe(method_family = none)]
        pub fn setTextContentManager(&self, text_content_manager: Option<&NSTextContentManager>);

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

        #[cfg(feature = "NSTextRange")]
        /// Setter for [`elementRange`][Self::elementRange].
        #[unsafe(method(setElementRange:))]
        #[unsafe(method_family = none)]
        pub fn setElementRange(&self, element_range: Option<&NSTextRange>);

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

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

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

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

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

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

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

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

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

        #[cfg(feature = "NSTextRange")]
        #[unsafe(method(paragraphSeparatorRange))]
        #[unsafe(method_family = none)]
        pub fn paragraphSeparatorRange(&self) -> Option<Retained<NSTextRange>>;
    );
}

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