//! 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinputtraittype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextInputTraitType(pub NSInteger);
impl NSTextInputTraitType {
    #[doc(alias = "NSTextInputTraitTypeDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "NSTextInputTraitTypeNo")]
    pub const No: Self = Self(1);
    #[doc(alias = "NSTextInputTraitTypeYes")]
    pub const Yes: Self = Self(2);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswritingtoolsbehavior?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWritingToolsBehavior(pub NSInteger);
impl NSWritingToolsBehavior {
    #[doc(alias = "NSWritingToolsBehaviorNone")]
    pub const None: Self = Self(-1);
    #[doc(alias = "NSWritingToolsBehaviorDefault")]
    pub const Default: Self = Self(0);
    #[doc(alias = "NSWritingToolsBehaviorComplete")]
    pub const Complete: Self = Self(1);
    #[doc(alias = "NSWritingToolsBehaviorLimited")]
    pub const Limited: Self = Self(2);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nswritingtoolsresultoptions?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWritingToolsResultOptions(pub NSUInteger);
bitflags::bitflags! {
    impl NSWritingToolsResultOptions: NSUInteger {
        #[doc(alias = "NSWritingToolsResultDefault")]
        const Default = 0;
        #[doc(alias = "NSWritingToolsResultPlainText")]
        const PlainText = 1<<0;
        #[doc(alias = "NSWritingToolsResultRichText")]
        const RichText = 1<<1;
        #[doc(alias = "NSWritingToolsResultList")]
        const List = 1<<2;
        #[doc(alias = "NSWritingToolsResultTable")]
        const Table = 1<<3;
    }
}

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

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

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextinputtraits?language=objc)
    pub unsafe trait NSTextInputTraits {
        #[optional]
        #[unsafe(method(autocorrectionType))]
        #[unsafe(method_family = none)]
        unsafe fn autocorrectionType(&self) -> NSTextInputTraitType;

        /// Setter for [`autocorrectionType`][Self::autocorrectionType].
        #[optional]
        #[unsafe(method(setAutocorrectionType:))]
        #[unsafe(method_family = none)]
        unsafe fn setAutocorrectionType(&self, autocorrection_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(spellCheckingType))]
        #[unsafe(method_family = none)]
        unsafe fn spellCheckingType(&self) -> NSTextInputTraitType;

        /// Setter for [`spellCheckingType`][Self::spellCheckingType].
        #[optional]
        #[unsafe(method(setSpellCheckingType:))]
        #[unsafe(method_family = none)]
        unsafe fn setSpellCheckingType(&self, spell_checking_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(grammarCheckingType))]
        #[unsafe(method_family = none)]
        unsafe fn grammarCheckingType(&self) -> NSTextInputTraitType;

        /// Setter for [`grammarCheckingType`][Self::grammarCheckingType].
        #[optional]
        #[unsafe(method(setGrammarCheckingType:))]
        #[unsafe(method_family = none)]
        unsafe fn setGrammarCheckingType(&self, grammar_checking_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(smartQuotesType))]
        #[unsafe(method_family = none)]
        unsafe fn smartQuotesType(&self) -> NSTextInputTraitType;

        /// Setter for [`smartQuotesType`][Self::smartQuotesType].
        #[optional]
        #[unsafe(method(setSmartQuotesType:))]
        #[unsafe(method_family = none)]
        unsafe fn setSmartQuotesType(&self, smart_quotes_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(smartDashesType))]
        #[unsafe(method_family = none)]
        unsafe fn smartDashesType(&self) -> NSTextInputTraitType;

        /// Setter for [`smartDashesType`][Self::smartDashesType].
        #[optional]
        #[unsafe(method(setSmartDashesType:))]
        #[unsafe(method_family = none)]
        unsafe fn setSmartDashesType(&self, smart_dashes_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(smartInsertDeleteType))]
        #[unsafe(method_family = none)]
        unsafe fn smartInsertDeleteType(&self) -> NSTextInputTraitType;

        /// Setter for [`smartInsertDeleteType`][Self::smartInsertDeleteType].
        #[optional]
        #[unsafe(method(setSmartInsertDeleteType:))]
        #[unsafe(method_family = none)]
        unsafe fn setSmartInsertDeleteType(&self, smart_insert_delete_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(textReplacementType))]
        #[unsafe(method_family = none)]
        unsafe fn textReplacementType(&self) -> NSTextInputTraitType;

        /// Setter for [`textReplacementType`][Self::textReplacementType].
        #[optional]
        #[unsafe(method(setTextReplacementType:))]
        #[unsafe(method_family = none)]
        unsafe fn setTextReplacementType(&self, text_replacement_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(dataDetectionType))]
        #[unsafe(method_family = none)]
        unsafe fn dataDetectionType(&self) -> NSTextInputTraitType;

        /// Setter for [`dataDetectionType`][Self::dataDetectionType].
        #[optional]
        #[unsafe(method(setDataDetectionType:))]
        #[unsafe(method_family = none)]
        unsafe fn setDataDetectionType(&self, data_detection_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(linkDetectionType))]
        #[unsafe(method_family = none)]
        unsafe fn linkDetectionType(&self) -> NSTextInputTraitType;

        /// Setter for [`linkDetectionType`][Self::linkDetectionType].
        #[optional]
        #[unsafe(method(setLinkDetectionType:))]
        #[unsafe(method_family = none)]
        unsafe fn setLinkDetectionType(&self, link_detection_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(textCompletionType))]
        #[unsafe(method_family = none)]
        unsafe fn textCompletionType(&self) -> NSTextInputTraitType;

        /// Setter for [`textCompletionType`][Self::textCompletionType].
        #[optional]
        #[unsafe(method(setTextCompletionType:))]
        #[unsafe(method_family = none)]
        unsafe fn setTextCompletionType(&self, text_completion_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(inlinePredictionType))]
        #[unsafe(method_family = none)]
        unsafe fn inlinePredictionType(&self) -> NSTextInputTraitType;

        /// Setter for [`inlinePredictionType`][Self::inlinePredictionType].
        #[optional]
        #[unsafe(method(setInlinePredictionType:))]
        #[unsafe(method_family = none)]
        unsafe fn setInlinePredictionType(&self, inline_prediction_type: NSTextInputTraitType);

        #[optional]
        #[unsafe(method(mathExpressionCompletionType))]
        #[unsafe(method_family = none)]
        unsafe fn mathExpressionCompletionType(&self) -> NSTextInputTraitType;

        /// Setter for [`mathExpressionCompletionType`][Self::mathExpressionCompletionType].
        #[optional]
        #[unsafe(method(setMathExpressionCompletionType:))]
        #[unsafe(method_family = none)]
        unsafe fn setMathExpressionCompletionType(
            &self,
            math_expression_completion_type: NSTextInputTraitType,
        );

        #[optional]
        #[unsafe(method(writingToolsBehavior))]
        #[unsafe(method_family = none)]
        unsafe fn writingToolsBehavior(&self) -> NSWritingToolsBehavior;

        /// Setter for [`writingToolsBehavior`][Self::writingToolsBehavior].
        #[optional]
        #[unsafe(method(setWritingToolsBehavior:))]
        #[unsafe(method_family = none)]
        unsafe fn setWritingToolsBehavior(&self, writing_tools_behavior: NSWritingToolsBehavior);

        #[optional]
        #[unsafe(method(allowedWritingToolsResultOptions))]
        #[unsafe(method_family = none)]
        unsafe fn allowedWritingToolsResultOptions(&self) -> NSWritingToolsResultOptions;

        /// Setter for [`allowedWritingToolsResultOptions`][Self::allowedWritingToolsResultOptions].
        #[optional]
        #[unsafe(method(setAllowedWritingToolsResultOptions:))]
        #[unsafe(method_family = none)]
        unsafe fn setAllowedWritingToolsResultOptions(
            &self,
            allowed_writing_tools_result_options: NSWritingToolsResultOptions,
        );
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextcheckingclient?language=objc)
    #[cfg(feature = "NSTextInputClient")]
    pub unsafe trait NSTextCheckingClient: NSTextInputClient + NSTextInputTraits {
        #[unsafe(method(annotatedSubstringForProposedRange:actualRange:))]
        #[unsafe(method_family = none)]
        unsafe fn annotatedSubstringForProposedRange_actualRange(
            &self,
            range: NSRange,
            actual_range: NSRangePointer,
        ) -> Option<Retained<NSAttributedString>>;

        #[unsafe(method(setAnnotations:range:))]
        #[unsafe(method_family = none)]
        unsafe fn setAnnotations_range(
            &self,
            annotations: &NSDictionary<NSAttributedStringKey, NSString>,
            range: NSRange,
        );

        #[unsafe(method(addAnnotations:range:))]
        #[unsafe(method_family = none)]
        unsafe fn addAnnotations_range(
            &self,
            annotations: &NSDictionary<NSAttributedStringKey, NSString>,
            range: NSRange,
        );

        #[unsafe(method(removeAnnotation:range:))]
        #[unsafe(method_family = none)]
        unsafe fn removeAnnotation_range(
            &self,
            annotation_name: &NSAttributedStringKey,
            range: NSRange,
        );

        #[unsafe(method(replaceCharactersInRange:withAnnotatedString:))]
        #[unsafe(method_family = none)]
        unsafe fn replaceCharactersInRange_withAnnotatedString(
            &self,
            range: NSRange,
            annotated_string: &NSAttributedString,
        );

        #[unsafe(method(selectAndShowRange:))]
        #[unsafe(method_family = none)]
        unsafe fn selectAndShowRange(&self, range: NSRange);

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        #[unsafe(method(viewForRange:firstRect:actualRange:))]
        #[unsafe(method_family = none)]
        unsafe fn viewForRange_firstRect_actualRange(
            &self,
            range: NSRange,
            first_rect: NSRectPointer,
            actual_range: NSRangePointer,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSView>>;

        #[cfg(all(feature = "NSCandidateListTouchBarItem", feature = "NSTouchBarItem"))]
        #[unsafe(method(candidateListTouchBarItem))]
        #[unsafe(method_family = none)]
        unsafe fn candidateListTouchBarItem(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSCandidateListTouchBarItem>>;
    }
);
