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

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

impl NSScriptCoercionHandler {
    extern_methods!(
        #[unsafe(method(sharedCoercionHandler))]
        #[unsafe(method_family = none)]
        pub fn sharedCoercionHandler() -> Retained<NSScriptCoercionHandler>;

        /// # Safety
        ///
        /// - `value` should be of the correct type.
        /// - `to_class` probably has further requirements.
        #[unsafe(method(coerceValue:toClass:))]
        #[unsafe(method_family = none)]
        pub unsafe fn coerceValue_toClass(
            &self,
            value: &AnyObject,
            to_class: &AnyClass,
        ) -> Option<Retained<AnyObject>>;

        /// # Safety
        ///
        /// - `coercer` should be of the correct type.
        /// - `selector` must be a valid selector.
        /// - `from_class` probably has further requirements.
        /// - `to_class` probably has further requirements.
        #[unsafe(method(registerCoercer:selector:toConvertFromClass:toClass:))]
        #[unsafe(method_family = none)]
        pub unsafe fn registerCoercer_selector_toConvertFromClass_toClass(
            &self,
            coercer: &AnyObject,
            selector: Sel,
            from_class: &AnyClass,
            to_class: &AnyClass,
        );
    );
}

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