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

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

impl UITextChecker {
    extern_methods!(
        #[unsafe(method(rangeOfMisspelledWordInString:range:startingAt:wrap:language:))]
        #[unsafe(method_family = none)]
        pub fn rangeOfMisspelledWordInString_range_startingAt_wrap_language(
            &self,
            string_to_check: &NSString,
            range: NSRange,
            starting_offset: NSInteger,
            wrap_flag: bool,
            language: &NSString,
        ) -> NSRange;

        #[unsafe(method(guessesForWordRange:inString:language:))]
        #[unsafe(method_family = none)]
        pub fn guessesForWordRange_inString_language(
            &self,
            range: NSRange,
            string: &NSString,
            language: &NSString,
        ) -> Option<Retained<NSArray<NSString>>>;

        #[unsafe(method(completionsForPartialWordRange:inString:language:))]
        #[unsafe(method_family = none)]
        pub fn completionsForPartialWordRange_inString_language(
            &self,
            range: NSRange,
            string: &NSString,
            language: &NSString,
        ) -> Option<Retained<NSArray<NSString>>>;

        #[unsafe(method(ignoreWord:))]
        #[unsafe(method_family = none)]
        pub fn ignoreWord(&self, word_to_ignore: &NSString);

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

        /// Setter for [`ignoredWords`][Self::ignoredWords].
        #[unsafe(method(setIgnoredWords:))]
        #[unsafe(method_family = none)]
        pub fn setIgnoredWords(&self, ignored_words: Option<&NSArray<NSString>>);

        #[unsafe(method(learnWord:))]
        #[unsafe(method_family = none)]
        pub fn learnWord(word: &NSString, mtm: MainThreadMarker);

        #[unsafe(method(hasLearnedWord:))]
        #[unsafe(method_family = none)]
        pub fn hasLearnedWord(word: &NSString, mtm: MainThreadMarker) -> bool;

        #[unsafe(method(unlearnWord:))]
        #[unsafe(method_family = none)]
        pub fn unlearnWord(word: &NSString, mtm: MainThreadMarker);

        #[unsafe(method(availableLanguages))]
        #[unsafe(method_family = none)]
        pub fn availableLanguages(mtm: MainThreadMarker) -> Retained<NSArray<NSString>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl UITextChecker {
    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(mtm: MainThreadMarker) -> Retained<Self>;
    );
}
