//! 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_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uitextdocumentproxy?language=objc)
    #[cfg(all(feature = "UITextInput", feature = "UITextInputTraits"))]
    pub unsafe trait UITextDocumentProxy: UIKeyInput + MainThreadOnly {
        #[unsafe(method(documentContextBeforeInput))]
        #[unsafe(method_family = none)]
        fn documentContextBeforeInput(&self) -> Option<Retained<NSString>>;

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

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

        #[unsafe(method(documentInputMode))]
        #[unsafe(method_family = none)]
        fn documentInputMode(&self) -> Option<Retained<UITextInputMode>>;

        #[unsafe(method(documentIdentifier))]
        #[unsafe(method_family = none)]
        fn documentIdentifier(&self) -> Retained<NSUUID>;

        #[unsafe(method(adjustTextPositionByCharacterOffset:))]
        #[unsafe(method_family = none)]
        fn adjustTextPositionByCharacterOffset(&self, offset: NSInteger);

        #[unsafe(method(setMarkedText:selectedRange:))]
        #[unsafe(method_family = none)]
        fn setMarkedText_selectedRange(&self, marked_text: &NSString, selected_range: NSRange);

        #[unsafe(method(unmarkText))]
        #[unsafe(method_family = none)]
        fn unmarkText(&self);
    }
);

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiinputviewcontroller?language=objc)
    #[unsafe(super(UIViewController, UIResponder, NSObject))]
    #[thread_kind = MainThreadOnly]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
    pub struct UIInputViewController;
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl NSCoding for UIInputViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for UIInputViewController {}
);

#[cfg(all(
    feature = "UIAppearance",
    feature = "UIResponder",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UIAppearanceContainer for UIInputViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl UIContentContainer for UIInputViewController {}
);

#[cfg(all(
    feature = "UIFocus",
    feature = "UIResponder",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UIFocusEnvironment for UIInputViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
extern_conformance!(
    unsafe impl UIResponderStandardEditActions for UIInputViewController {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITextInput",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UITextInputDelegate for UIInputViewController {}
);

#[cfg(all(
    feature = "UIResponder",
    feature = "UITraitCollection",
    feature = "UIViewController"
))]
extern_conformance!(
    unsafe impl UITraitEnvironment for UIInputViewController {}
);

#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIInputViewController {
    extern_methods!(
        #[cfg(all(feature = "UIInputView", feature = "UIView"))]
        #[unsafe(method(inputView))]
        #[unsafe(method_family = none)]
        pub fn inputView(&self) -> Option<Retained<UIInputView>>;

        #[cfg(all(feature = "UIInputView", feature = "UIView"))]
        /// Setter for [`inputView`][Self::inputView].
        #[unsafe(method(setInputView:))]
        #[unsafe(method_family = none)]
        pub fn setInputView(&self, input_view: Option<&UIInputView>);

        #[cfg(all(feature = "UITextInput", feature = "UITextInputTraits"))]
        #[unsafe(method(textDocumentProxy))]
        #[unsafe(method_family = none)]
        pub fn textDocumentProxy(&self) -> Retained<ProtocolObject<dyn UITextDocumentProxy>>;

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

        /// Setter for [`primaryLanguage`][Self::primaryLanguage].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPrimaryLanguage:))]
        #[unsafe(method_family = none)]
        pub fn setPrimaryLanguage(&self, primary_language: Option<&NSString>);

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

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

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

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

        #[unsafe(method(dismissKeyboard))]
        #[unsafe(method_family = none)]
        pub fn dismissKeyboard(&self);

        #[unsafe(method(advanceToNextInputMode))]
        #[unsafe(method_family = none)]
        pub fn advanceToNextInputMode(&self);

        #[cfg(all(feature = "UIEvent", feature = "UIView"))]
        #[unsafe(method(handleInputModeListFromView:withEvent:))]
        #[unsafe(method_family = none)]
        pub fn handleInputModeListFromView_withEvent(&self, view: &UIView, event: &UIEvent);

        #[cfg(all(feature = "UILexicon", feature = "block2"))]
        #[unsafe(method(requestSupplementaryLexiconWithCompletion:))]
        #[unsafe(method_family = none)]
        pub fn requestSupplementaryLexiconWithCompletion(
            &self,
            completion_handler: &block2::DynBlock<dyn Fn(NonNull<UILexicon>)>,
        );
    );
}

/// Methods declared on superclass `UIViewController`.
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIInputViewController {
    extern_methods!(
        #[unsafe(method(initWithNibName:bundle:))]
        #[unsafe(method_family = init)]
        pub fn initWithNibName_bundle(
            this: Allocated<Self>,
            nib_name_or_nil: Option<&NSString>,
            nib_bundle_or_nil: Option<&NSBundle>,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `coder` possibly has further requirements.
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            coder: &NSCoder,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "UIResponder", feature = "UIViewController"))]
impl UIInputViewController {
    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>;
    );
}
