//! 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!(
    /// Groups together properties to configure and create a specialized function by passing it to a factory method.
    ///
    /// You can pass an instance of this class to any methods that accept a ``MTL4FunctionDescriptor`` parameter to
    /// provide extra configuration, such as function constants or a name.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4specializedfunctiondescriptor?language=objc)
    #[unsafe(super(MTL4FunctionDescriptor, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MTL4FunctionDescriptor")]
    pub struct MTL4SpecializedFunctionDescriptor;
);

#[cfg(feature = "MTL4FunctionDescriptor")]
extern_conformance!(
    unsafe impl NSCopying for MTL4SpecializedFunctionDescriptor {}
);

#[cfg(feature = "MTL4FunctionDescriptor")]
unsafe impl CopyingHelper for MTL4SpecializedFunctionDescriptor {
    type Result = Self;
}

#[cfg(feature = "MTL4FunctionDescriptor")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MTL4SpecializedFunctionDescriptor {}
);

#[cfg(feature = "MTL4FunctionDescriptor")]
impl MTL4SpecializedFunctionDescriptor {
    extern_methods!(
        /// Provides a descriptor that corresponds to a base function that the specialization applies to.
        #[unsafe(method(functionDescriptor))]
        #[unsafe(method_family = none)]
        pub fn functionDescriptor(&self) -> Option<Retained<MTL4FunctionDescriptor>>;

        /// Setter for [`functionDescriptor`][Self::functionDescriptor].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setFunctionDescriptor:))]
        #[unsafe(method_family = none)]
        pub fn setFunctionDescriptor(&self, function_descriptor: Option<&MTL4FunctionDescriptor>);

        /// Assigns an optional name to the specialized function.
        #[unsafe(method(specializedName))]
        #[unsafe(method_family = none)]
        pub fn specializedName(&self) -> Option<Retained<NSString>>;

        /// Setter for [`specializedName`][Self::specializedName].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setSpecializedName:))]
        #[unsafe(method_family = none)]
        pub fn setSpecializedName(&self, specialized_name: Option<&NSString>);

        #[cfg(feature = "MTLFunctionConstantValues")]
        /// Configures optional function constant values to associate with the function.
        #[unsafe(method(constantValues))]
        #[unsafe(method_family = none)]
        pub fn constantValues(&self) -> Option<Retained<MTLFunctionConstantValues>>;

        #[cfg(feature = "MTLFunctionConstantValues")]
        /// Setter for [`constantValues`][Self::constantValues].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setConstantValues:))]
        #[unsafe(method_family = none)]
        pub fn setConstantValues(&self, constant_values: Option<&MTLFunctionConstantValues>);
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "MTL4FunctionDescriptor")]
impl MTL4SpecializedFunctionDescriptor {
    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>;
    );
}

#[cfg(feature = "MTL4FunctionDescriptor")]
impl DefaultRetained for MTL4SpecializedFunctionDescriptor {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}
