//! 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/nsuserscripttaskcompletionhandler?language=objc)
#[cfg(all(feature = "NSError", feature = "block2"))]
pub type NSUserScriptTaskCompletionHandler = *mut block2::DynBlock<dyn Fn(*mut NSError)>;

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

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

impl NSUserScriptTask {
    extern_methods!(
        #[cfg(all(feature = "NSError", feature = "NSURL"))]
        #[unsafe(method(initWithURL:error:_))]
        #[unsafe(method_family = init)]
        pub fn initWithURL_error(
            this: Allocated<Self>,
            url: &NSURL,
        ) -> Result<Retained<Self>, Retained<NSError>>;

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

        #[cfg(all(feature = "NSError", feature = "block2"))]
        /// # Safety
        ///
        /// `handler` must be a valid pointer or null.
        #[unsafe(method(executeWithCompletionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn executeWithCompletionHandler(
            &self,
            handler: NSUserScriptTaskCompletionHandler,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl NSUserScriptTask {
    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 NSUserScriptTask {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserunixtaskcompletionhandler?language=objc)
#[cfg(all(feature = "NSError", feature = "block2"))]
pub type NSUserUnixTaskCompletionHandler = *mut block2::DynBlock<dyn Fn(*mut NSError)>;

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

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

impl NSUserUnixTask {
    extern_methods!(
        #[cfg(feature = "NSFileHandle")]
        #[unsafe(method(standardInput))]
        #[unsafe(method_family = none)]
        pub fn standardInput(&self) -> Option<Retained<NSFileHandle>>;

        #[cfg(feature = "NSFileHandle")]
        /// Setter for [`standardInput`][Self::standardInput].
        #[unsafe(method(setStandardInput:))]
        #[unsafe(method_family = none)]
        pub fn setStandardInput(&self, standard_input: Option<&NSFileHandle>);

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

        #[cfg(feature = "NSFileHandle")]
        /// Setter for [`standardOutput`][Self::standardOutput].
        #[unsafe(method(setStandardOutput:))]
        #[unsafe(method_family = none)]
        pub fn setStandardOutput(&self, standard_output: Option<&NSFileHandle>);

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

        #[cfg(feature = "NSFileHandle")]
        /// Setter for [`standardError`][Self::standardError].
        #[unsafe(method(setStandardError:))]
        #[unsafe(method_family = none)]
        pub fn setStandardError(&self, standard_error: Option<&NSFileHandle>);

        #[cfg(all(
            feature = "NSArray",
            feature = "NSError",
            feature = "NSString",
            feature = "block2"
        ))]
        /// # Safety
        ///
        /// `handler` must be a valid pointer or null.
        #[unsafe(method(executeWithArguments:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn executeWithArguments_completionHandler(
            &self,
            arguments: Option<&NSArray<NSString>>,
            handler: NSUserUnixTaskCompletionHandler,
        );
    );
}

/// Methods declared on superclass `NSUserScriptTask`.
impl NSUserUnixTask {
    extern_methods!(
        #[cfg(all(feature = "NSError", feature = "NSURL"))]
        #[unsafe(method(initWithURL:error:_))]
        #[unsafe(method_family = init)]
        pub fn initWithURL_error(
            this: Allocated<Self>,
            url: &NSURL,
        ) -> Result<Retained<Self>, Retained<NSError>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSUserUnixTask {
    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 NSUserUnixTask {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserapplescripttaskcompletionhandler?language=objc)
#[cfg(all(
    feature = "NSAppleEventDescriptor",
    feature = "NSError",
    feature = "block2"
))]
pub type NSUserAppleScriptTaskCompletionHandler =
    *mut block2::DynBlock<dyn Fn(*mut NSAppleEventDescriptor, *mut NSError)>;

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

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

impl NSUserAppleScriptTask {
    extern_methods!(
        #[cfg(all(
            feature = "NSAppleEventDescriptor",
            feature = "NSError",
            feature = "block2"
        ))]
        /// # Safety
        ///
        /// `handler` must be a valid pointer or null.
        #[unsafe(method(executeWithAppleEvent:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn executeWithAppleEvent_completionHandler(
            &self,
            event: Option<&NSAppleEventDescriptor>,
            handler: NSUserAppleScriptTaskCompletionHandler,
        );
    );
}

/// Methods declared on superclass `NSUserScriptTask`.
impl NSUserAppleScriptTask {
    extern_methods!(
        #[cfg(all(feature = "NSError", feature = "NSURL"))]
        #[unsafe(method(initWithURL:error:_))]
        #[unsafe(method_family = init)]
        pub fn initWithURL_error(
            this: Allocated<Self>,
            url: &NSURL,
        ) -> Result<Retained<Self>, Retained<NSError>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSUserAppleScriptTask {
    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 NSUserAppleScriptTask {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsuserautomatortaskcompletionhandler?language=objc)
#[cfg(all(feature = "NSError", feature = "block2"))]
pub type NSUserAutomatorTaskCompletionHandler =
    *mut block2::DynBlock<dyn Fn(*mut AnyObject, *mut NSError)>;

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

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

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

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

        #[cfg(all(feature = "NSError", feature = "NSObject", feature = "block2"))]
        /// # Safety
        ///
        /// - `input` should be of the correct type.
        /// - `handler` must be a valid pointer or null.
        #[unsafe(method(executeWithInput:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn executeWithInput_completionHandler(
            &self,
            input: Option<&ProtocolObject<dyn NSSecureCoding>>,
            handler: NSUserAutomatorTaskCompletionHandler,
        );
    );
}

/// Methods declared on superclass `NSUserScriptTask`.
impl NSUserAutomatorTask {
    extern_methods!(
        #[cfg(all(feature = "NSError", feature = "NSURL"))]
        #[unsafe(method(initWithURL:error:_))]
        #[unsafe(method_family = init)]
        pub fn initWithURL_error(
            this: Allocated<Self>,
            url: &NSURL,
        ) -> Result<Retained<Self>, Retained<NSError>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSUserAutomatorTask {
    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 NSUserAutomatorTask {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
