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

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

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

impl NSInvocation {
    extern_methods!(
        #[cfg(feature = "NSMethodSignature")]
        #[unsafe(method(invocationWithMethodSignature:))]
        #[unsafe(method_family = none)]
        pub unsafe fn invocationWithMethodSignature(
            sig: &NSMethodSignature,
        ) -> Retained<NSInvocation>;

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

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

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

        /// # Safety
        ///
        /// This is not retained internally, you must ensure the object is still alive.
        #[unsafe(method(target))]
        #[unsafe(method_family = none)]
        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;

        /// Setter for [`target`][Self::target].
        ///
        /// # Safety
        ///
        /// - `target` should be of the correct type.
        /// - This is unretained, you must ensure the object is kept alive while in use.
        #[unsafe(method(setTarget:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);

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

        /// Setter for [`selector`][Self::selector].
        ///
        /// # Safety
        ///
        /// `selector` must be a valid selector.
        #[unsafe(method(setSelector:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSelector(&self, selector: Sel);

        /// # Safety
        ///
        /// `ret_loc` must be a valid pointer.
        #[unsafe(method(getReturnValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getReturnValue(&self, ret_loc: NonNull<c_void>);

        /// # Safety
        ///
        /// `ret_loc` must be a valid pointer.
        #[unsafe(method(setReturnValue:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setReturnValue(&self, ret_loc: NonNull<c_void>);

        /// # Safety
        ///
        /// `argument_location` must be a valid pointer.
        #[unsafe(method(getArgument:atIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn getArgument_atIndex(
            &self,
            argument_location: NonNull<c_void>,
            idx: NSInteger,
        );

        /// # Safety
        ///
        /// `argument_location` must be a valid pointer.
        #[unsafe(method(setArgument:atIndex:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setArgument_atIndex(
            &self,
            argument_location: NonNull<c_void>,
            idx: NSInteger,
        );

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

        /// # Safety
        ///
        /// `target` should be of the correct type.
        #[unsafe(method(invokeWithTarget:))]
        #[unsafe(method_family = none)]
        pub unsafe fn invokeWithTarget(&self, target: &AnyObject);

        /// # Safety
        ///
        /// `imp` must be a valid IMP.
        #[unsafe(method(invokeUsingIMP:))]
        #[unsafe(method_family = none)]
        pub unsafe fn invokeUsingIMP(&self, imp: Option<Imp>);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSInvocation {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}
