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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsnoscripterror?language=objc)
pub const NSNoScriptError: NSInteger = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsreceiverevaluationscripterror?language=objc)
pub const NSReceiverEvaluationScriptError: NSInteger = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nskeyspecifierevaluationscripterror?language=objc)
pub const NSKeySpecifierEvaluationScriptError: NSInteger = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsargumentevaluationscripterror?language=objc)
pub const NSArgumentEvaluationScriptError: NSInteger = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsreceiverscanthandlecommandscripterror?language=objc)
pub const NSReceiversCantHandleCommandScriptError: NSInteger = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsrequiredargumentsmissingscripterror?language=objc)
pub const NSRequiredArgumentsMissingScriptError: NSInteger = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsargumentswrongscripterror?language=objc)
pub const NSArgumentsWrongScriptError: NSInteger = 6;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsunknownkeyscripterror?language=objc)
pub const NSUnknownKeyScriptError: NSInteger = 7;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinternalscripterror?language=objc)
pub const NSInternalScriptError: NSInteger = 8;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsoperationnotsupportedforkeyscripterror?language=objc)
pub const NSOperationNotSupportedForKeyScriptError: NSInteger = 9;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nscannotcreatescriptcommanderror?language=objc)
pub const NSCannotCreateScriptCommandError: NSInteger = 10;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsscriptcommand?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSScriptCommand;
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSScriptCommand {}
);

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

impl NSScriptCommand {
    extern_methods!(
        #[cfg(feature = "NSScriptCommandDescription")]
        #[unsafe(method(initWithCommandDescription:))]
        #[unsafe(method_family = init)]
        pub fn initWithCommandDescription(
            this: Allocated<Self>,
            command_def: &NSScriptCommandDescription,
        ) -> Retained<Self>;

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

        #[cfg(feature = "NSScriptCommandDescription")]
        #[unsafe(method(commandDescription))]
        #[unsafe(method_family = none)]
        pub fn commandDescription(&self) -> Retained<NSScriptCommandDescription>;

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

        /// Setter for [`directParameter`][Self::directParameter].
        ///
        /// # Safety
        ///
        /// `direct_parameter` should be of the correct type.
        #[unsafe(method(setDirectParameter:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDirectParameter(&self, direct_parameter: Option<&AnyObject>);

        #[cfg(feature = "NSScriptObjectSpecifiers")]
        #[unsafe(method(receiversSpecifier))]
        #[unsafe(method_family = none)]
        pub fn receiversSpecifier(&self) -> Option<Retained<NSScriptObjectSpecifier>>;

        #[cfg(feature = "NSScriptObjectSpecifiers")]
        /// Setter for [`receiversSpecifier`][Self::receiversSpecifier].
        #[unsafe(method(setReceiversSpecifier:))]
        #[unsafe(method_family = none)]
        pub fn setReceiversSpecifier(&self, receivers_specifier: Option<&NSScriptObjectSpecifier>);

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

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[unsafe(method(arguments))]
        #[unsafe(method_family = none)]
        pub fn arguments(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        /// Setter for [`arguments`][Self::arguments].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `arguments` generic should be of the correct type.
        #[unsafe(method(setArguments:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setArguments(&self, arguments: Option<&NSDictionary<NSString, AnyObject>>);

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[unsafe(method(evaluatedArguments))]
        #[unsafe(method_family = none)]
        pub fn evaluatedArguments(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

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

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

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

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

        /// Setter for [`scriptErrorNumber`][Self::scriptErrorNumber].
        #[unsafe(method(setScriptErrorNumber:))]
        #[unsafe(method_family = none)]
        pub fn setScriptErrorNumber(&self, script_error_number: NSInteger);

        #[cfg(feature = "NSAppleEventDescriptor")]
        #[unsafe(method(scriptErrorOffendingObjectDescriptor))]
        #[unsafe(method_family = none)]
        pub fn scriptErrorOffendingObjectDescriptor(
            &self,
        ) -> Option<Retained<NSAppleEventDescriptor>>;

        #[cfg(feature = "NSAppleEventDescriptor")]
        /// Setter for [`scriptErrorOffendingObjectDescriptor`][Self::scriptErrorOffendingObjectDescriptor].
        #[unsafe(method(setScriptErrorOffendingObjectDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setScriptErrorOffendingObjectDescriptor(
            &self,
            script_error_offending_object_descriptor: Option<&NSAppleEventDescriptor>,
        );

        #[cfg(feature = "NSAppleEventDescriptor")]
        #[unsafe(method(scriptErrorExpectedTypeDescriptor))]
        #[unsafe(method_family = none)]
        pub fn scriptErrorExpectedTypeDescriptor(&self)
            -> Option<Retained<NSAppleEventDescriptor>>;

        #[cfg(feature = "NSAppleEventDescriptor")]
        /// Setter for [`scriptErrorExpectedTypeDescriptor`][Self::scriptErrorExpectedTypeDescriptor].
        #[unsafe(method(setScriptErrorExpectedTypeDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setScriptErrorExpectedTypeDescriptor(
            &self,
            script_error_expected_type_descriptor: Option<&NSAppleEventDescriptor>,
        );

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

        #[cfg(feature = "NSString")]
        /// Setter for [`scriptErrorString`][Self::scriptErrorString].
        ///
        /// This is [copied][crate::NSCopying::copy] when set.
        #[unsafe(method(setScriptErrorString:))]
        #[unsafe(method_family = none)]
        pub fn setScriptErrorString(&self, script_error_string: Option<&NSString>);

        #[unsafe(method(currentCommand))]
        #[unsafe(method_family = none)]
        pub fn currentCommand() -> Option<Retained<NSScriptCommand>>;

        #[cfg(feature = "NSAppleEventDescriptor")]
        #[unsafe(method(appleEvent))]
        #[unsafe(method_family = none)]
        pub fn appleEvent(&self) -> Option<Retained<NSAppleEventDescriptor>>;

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

        /// # Safety
        ///
        /// `result` should be of the correct type.
        #[unsafe(method(resumeExecutionWithResult:))]
        #[unsafe(method_family = none)]
        pub unsafe fn resumeExecutionWithResult(&self, result: Option<&AnyObject>);
    );
}

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

impl DefaultRetained for NSScriptCommand {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
