//! 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;
        #[doc(alias = "NSWritingToolsResultPresentationIntent")]
        const PresentationIntent = 1<<4;
    }
}

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)]
        fn autocorrectionType(&self) -> NSTextInputTraitType;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        /// Setter for [`allowedWritingToolsResultOptions`][Self::allowedWritingToolsResultOptions].
        #[optional]
        #[unsafe(method(setAllowedWritingToolsResultOptions:))]
        #[unsafe(method_family = none)]
        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 {
        /// # Safety
        ///
        /// `actual_range` must be a valid pointer or null.
        #[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)]
        fn setAnnotations_range(
            &self,
            annotations: &NSDictionary<NSAttributedStringKey, NSString>,
            range: NSRange,
        );

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

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

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

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

        #[cfg(all(feature = "NSResponder", feature = "NSView"))]
        /// # Safety
        ///
        /// - `first_rect` must be a valid pointer or null.
        /// - `actual_range` must be a valid pointer or null.
        #[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)]
        fn candidateListTouchBarItem(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<NSCandidateListTouchBarItem>>;
    }
);
