//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nslinebreakmode?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineBreakMode(pub NSInteger);
impl NSLineBreakMode {
    #[doc(alias = "NSLineBreakByWordWrapping")]
    pub const ByWordWrapping: Self = Self(0);
    #[doc(alias = "NSLineBreakByCharWrapping")]
    pub const ByCharWrapping: Self = Self(1);
    #[doc(alias = "NSLineBreakByClipping")]
    pub const ByClipping: Self = Self(2);
    #[doc(alias = "NSLineBreakByTruncatingHead")]
    pub const ByTruncatingHead: Self = Self(3);
    #[doc(alias = "NSLineBreakByTruncatingTail")]
    pub const ByTruncatingTail: Self = Self(4);
    #[doc(alias = "NSLineBreakByTruncatingMiddle")]
    pub const ByTruncatingMiddle: Self = Self(5);
}

unsafe impl Encode for NSLineBreakMode {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSLineBreakMode {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nslinebreakstrategy?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineBreakStrategy(pub NSUInteger);
bitflags::bitflags! {
    impl NSLineBreakStrategy: NSUInteger {
        #[doc(alias = "NSLineBreakStrategyNone")]
        const None = 0;
        #[doc(alias = "NSLineBreakStrategyPushOut")]
        const PushOut = 1<<0;
        #[doc(alias = "NSLineBreakStrategyHangulWordPriority")]
        const HangulWordPriority = 1<<1;
        #[doc(alias = "NSLineBreakStrategyStandard")]
        const Standard = 0xFFFF;
    }
}

unsafe impl Encode for NSLineBreakStrategy {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSLineBreakStrategy {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstexttaboptionkey?language=objc)
// NS_TYPED_ENUM
pub type NSTextTabOptionKey = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nstabcolumnterminatorsattributename?language=objc)
    pub static NSTabColumnTerminatorsAttributeName: &'static NSTextTabOptionKey;
}

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

extern_conformance!(
    unsafe impl NSCoding for NSTextTab {}
);

extern_conformance!(
    unsafe impl NSCopying for NSTextTab {}
);

unsafe impl CopyingHelper for NSTextTab {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for NSTextTab {}
);

impl NSTextTab {
    extern_methods!(
        #[unsafe(method(columnTerminatorsForLocale:))]
        #[unsafe(method_family = none)]
        pub fn columnTerminatorsForLocale(a_locale: Option<&NSLocale>) -> Retained<NSCharacterSet>;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(location))]
        #[unsafe(method_family = none)]
        pub fn location(&self) -> CGFloat;

        #[unsafe(method(options))]
        #[unsafe(method_family = none)]
        pub fn options(&self) -> Retained<NSDictionary<NSTextTabOptionKey, AnyObject>>;
    );
}

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

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

extern_conformance!(
    unsafe impl NSCoding for NSParagraphStyle {}
);

extern_conformance!(
    unsafe impl NSCopying for NSParagraphStyle {}
);

unsafe impl CopyingHelper for NSParagraphStyle {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSMutableCopying for NSParagraphStyle {}
);

unsafe impl MutableCopyingHelper for NSParagraphStyle {
    type Result = NSMutableParagraphStyle;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for NSParagraphStyle {}
);

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

        #[cfg(feature = "NSText")]
        #[unsafe(method(defaultWritingDirectionForLanguage:))]
        #[unsafe(method_family = none)]
        pub fn defaultWritingDirectionForLanguage(
            language_name: Option<&NSString>,
        ) -> NSWritingDirection;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(lineSpacing))]
        #[unsafe(method_family = none)]
        pub fn lineSpacing(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(paragraphSpacing))]
        #[unsafe(method_family = none)]
        pub fn paragraphSpacing(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(headIndent))]
        #[unsafe(method_family = none)]
        pub fn headIndent(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(tailIndent))]
        #[unsafe(method_family = none)]
        pub fn tailIndent(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(firstLineHeadIndent))]
        #[unsafe(method_family = none)]
        pub fn firstLineHeadIndent(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(minimumLineHeight))]
        #[unsafe(method_family = none)]
        pub fn minimumLineHeight(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(maximumLineHeight))]
        #[unsafe(method_family = none)]
        pub fn maximumLineHeight(&self) -> CGFloat;

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

        #[cfg(feature = "NSText")]
        #[unsafe(method(baseWritingDirection))]
        #[unsafe(method_family = none)]
        pub fn baseWritingDirection(&self) -> NSWritingDirection;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(lineHeightMultiple))]
        #[unsafe(method_family = none)]
        pub fn lineHeightMultiple(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(paragraphSpacingBefore))]
        #[unsafe(method_family = none)]
        pub fn paragraphSpacingBefore(&self) -> CGFloat;

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

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

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

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(defaultTabInterval))]
        #[unsafe(method_family = none)]
        pub fn defaultTabInterval(&self) -> CGFloat;

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

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

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

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

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

extern_conformance!(
    unsafe impl NSCoding for NSMutableParagraphStyle {}
);

extern_conformance!(
    unsafe impl NSCopying for NSMutableParagraphStyle {}
);

unsafe impl CopyingHelper for NSMutableParagraphStyle {
    type Result = NSParagraphStyle;
}

extern_conformance!(
    unsafe impl NSMutableCopying for NSMutableParagraphStyle {}
);

unsafe impl MutableCopyingHelper for NSMutableParagraphStyle {
    type Result = Self;
}

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

extern_conformance!(
    unsafe impl NSSecureCoding for NSMutableParagraphStyle {}
);

impl NSMutableParagraphStyle {
    extern_methods!(
        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(lineSpacing))]
        #[unsafe(method_family = none)]
        pub fn lineSpacing(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`lineSpacing`][Self::lineSpacing].
        #[unsafe(method(setLineSpacing:))]
        #[unsafe(method_family = none)]
        pub fn setLineSpacing(&self, line_spacing: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(paragraphSpacing))]
        #[unsafe(method_family = none)]
        pub fn paragraphSpacing(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`paragraphSpacing`][Self::paragraphSpacing].
        #[unsafe(method(setParagraphSpacing:))]
        #[unsafe(method_family = none)]
        pub fn setParagraphSpacing(&self, paragraph_spacing: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(firstLineHeadIndent))]
        #[unsafe(method_family = none)]
        pub fn firstLineHeadIndent(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`firstLineHeadIndent`][Self::firstLineHeadIndent].
        #[unsafe(method(setFirstLineHeadIndent:))]
        #[unsafe(method_family = none)]
        pub fn setFirstLineHeadIndent(&self, first_line_head_indent: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(headIndent))]
        #[unsafe(method_family = none)]
        pub fn headIndent(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`headIndent`][Self::headIndent].
        #[unsafe(method(setHeadIndent:))]
        #[unsafe(method_family = none)]
        pub fn setHeadIndent(&self, head_indent: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(tailIndent))]
        #[unsafe(method_family = none)]
        pub fn tailIndent(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`tailIndent`][Self::tailIndent].
        #[unsafe(method(setTailIndent:))]
        #[unsafe(method_family = none)]
        pub fn setTailIndent(&self, tail_indent: CGFloat);

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

        /// Setter for [`lineBreakMode`][Self::lineBreakMode].
        #[unsafe(method(setLineBreakMode:))]
        #[unsafe(method_family = none)]
        pub fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(minimumLineHeight))]
        #[unsafe(method_family = none)]
        pub fn minimumLineHeight(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`minimumLineHeight`][Self::minimumLineHeight].
        #[unsafe(method(setMinimumLineHeight:))]
        #[unsafe(method_family = none)]
        pub fn setMinimumLineHeight(&self, minimum_line_height: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(maximumLineHeight))]
        #[unsafe(method_family = none)]
        pub fn maximumLineHeight(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`maximumLineHeight`][Self::maximumLineHeight].
        #[unsafe(method(setMaximumLineHeight:))]
        #[unsafe(method_family = none)]
        pub fn setMaximumLineHeight(&self, maximum_line_height: CGFloat);

        #[cfg(feature = "NSText")]
        #[unsafe(method(baseWritingDirection))]
        #[unsafe(method_family = none)]
        pub fn baseWritingDirection(&self) -> NSWritingDirection;

        #[cfg(feature = "NSText")]
        /// Setter for [`baseWritingDirection`][Self::baseWritingDirection].
        #[unsafe(method(setBaseWritingDirection:))]
        #[unsafe(method_family = none)]
        pub fn setBaseWritingDirection(&self, base_writing_direction: NSWritingDirection);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(lineHeightMultiple))]
        #[unsafe(method_family = none)]
        pub fn lineHeightMultiple(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`lineHeightMultiple`][Self::lineHeightMultiple].
        #[unsafe(method(setLineHeightMultiple:))]
        #[unsafe(method_family = none)]
        pub fn setLineHeightMultiple(&self, line_height_multiple: CGFloat);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(paragraphSpacingBefore))]
        #[unsafe(method_family = none)]
        pub fn paragraphSpacingBefore(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`paragraphSpacingBefore`][Self::paragraphSpacingBefore].
        #[unsafe(method(setParagraphSpacingBefore:))]
        #[unsafe(method_family = none)]
        pub fn setParagraphSpacingBefore(&self, paragraph_spacing_before: CGFloat);

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

        /// Setter for [`hyphenationFactor`][Self::hyphenationFactor].
        #[unsafe(method(setHyphenationFactor:))]
        #[unsafe(method_family = none)]
        pub fn setHyphenationFactor(&self, hyphenation_factor: c_float);

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

        /// Setter for [`usesDefaultHyphenation`][Self::usesDefaultHyphenation].
        #[unsafe(method(setUsesDefaultHyphenation:))]
        #[unsafe(method_family = none)]
        pub fn setUsesDefaultHyphenation(&self, uses_default_hyphenation: bool);

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

        /// Setter for [`tabStops`][Self::tabStops].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTabStops:))]
        #[unsafe(method_family = none)]
        pub fn setTabStops(&self, tab_stops: Option<&NSArray<NSTextTab>>);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(defaultTabInterval))]
        #[unsafe(method_family = none)]
        pub fn defaultTabInterval(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`defaultTabInterval`][Self::defaultTabInterval].
        #[unsafe(method(setDefaultTabInterval:))]
        #[unsafe(method_family = none)]
        pub fn setDefaultTabInterval(&self, default_tab_interval: CGFloat);

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

        /// Setter for [`allowsDefaultTighteningForTruncation`][Self::allowsDefaultTighteningForTruncation].
        #[unsafe(method(setAllowsDefaultTighteningForTruncation:))]
        #[unsafe(method_family = none)]
        pub fn setAllowsDefaultTighteningForTruncation(
            &self,
            allows_default_tightening_for_truncation: bool,
        );

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

        /// Setter for [`lineBreakStrategy`][Self::lineBreakStrategy].
        #[unsafe(method(setLineBreakStrategy:))]
        #[unsafe(method_family = none)]
        pub fn setLineBreakStrategy(&self, line_break_strategy: NSLineBreakStrategy);

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

        #[cfg(feature = "NSTextList")]
        /// Setter for [`textLists`][Self::textLists].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setTextLists:))]
        #[unsafe(method_family = none)]
        pub fn setTextLists(&self, text_lists: &NSArray<NSTextList>);

        #[unsafe(method(addTabStop:))]
        #[unsafe(method_family = none)]
        pub fn addTabStop(&self, an_object: &NSTextTab);

        #[unsafe(method(removeTabStop:))]
        #[unsafe(method_family = none)]
        pub fn removeTabStop(&self, an_object: &NSTextTab);

        #[unsafe(method(setParagraphStyle:))]
        #[unsafe(method_family = none)]
        pub fn setParagraphStyle(&self, obj: &NSParagraphStyle);
    );
}

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

impl NSTextTab {
    extern_methods!(
        #[cfg(all(feature = "NSText", feature = "objc2-core-foundation"))]
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(initWithTextAlignment:location:options:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTextAlignment_location_options(
            this: Allocated<Self>,
            alignment: NSTextAlignment,
            loc: CGFloat,
            options: &NSDictionary<NSTextTabOptionKey, AnyObject>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSText")]
        #[unsafe(method(alignment))]
        #[unsafe(method_family = none)]
        pub fn alignment(&self) -> NSTextAlignment;
    );
}

impl NSParagraphStyle {
    extern_methods!(
        #[cfg(feature = "NSText")]
        #[unsafe(method(alignment))]
        #[unsafe(method_family = none)]
        pub fn alignment(&self) -> NSTextAlignment;
    );
}

impl NSMutableParagraphStyle {
    extern_methods!(
        #[cfg(feature = "NSText")]
        #[unsafe(method(alignment))]
        #[unsafe(method_family = none)]
        pub fn alignment(&self) -> NSTextAlignment;

        #[cfg(feature = "NSText")]
        /// Setter for [`alignment`][Self::alignment].
        #[unsafe(method(setAlignment:))]
        #[unsafe(method_family = none)]
        pub fn setAlignment(&self, alignment: NSTextAlignment);
    );
}
