//! 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/appkit/nsspeechrecognizer?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSSpeechRecognizer;
);

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

impl NSSpeechRecognizer {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Option<Retained<Self>>;

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

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

        #[unsafe(method(delegate))]
        #[unsafe(method_family = none)]
        pub unsafe fn delegate(
            &self,
            mtm: MainThreadMarker,
        ) -> Option<Retained<ProtocolObject<dyn NSSpeechRecognizerDelegate>>>;

        /// This is a [weak property][objc2::topics::weak_property].
        /// Setter for [`delegate`][Self::delegate].
        #[unsafe(method(setDelegate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSSpeechRecognizerDelegate>>,
        );

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

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

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

        /// Setter for [`displayedCommandsTitle`][Self::displayedCommandsTitle].
        #[unsafe(method(setDisplayedCommandsTitle:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDisplayedCommandsTitle(&self, displayed_commands_title: Option<&NSString>);

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

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

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

        /// Setter for [`blocksOtherRecognizers`][Self::blocksOtherRecognizers].
        #[unsafe(method(setBlocksOtherRecognizers:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setBlocksOtherRecognizers(&self, blocks_other_recognizers: bool);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSSpeechRecognizer {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsspeechrecognizerdelegate?language=objc)
    pub unsafe trait NSSpeechRecognizerDelegate: NSObjectProtocol + MainThreadOnly {
        #[optional]
        #[unsafe(method(speechRecognizer:didRecognizeCommand:))]
        #[unsafe(method_family = none)]
        unsafe fn speechRecognizer_didRecognizeCommand(
            &self,
            sender: &NSSpeechRecognizer,
            command: &NSString,
        );
    }
);
