//! 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 that describe a shader function suitable for stitching.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4stitchedfunctiondescriptor?language=objc)
    #[unsafe(super(MTL4FunctionDescriptor, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MTL4FunctionDescriptor")]
    pub struct MTL4StitchedFunctionDescriptor;
);

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

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

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

#[cfg(feature = "MTL4FunctionDescriptor")]
impl MTL4StitchedFunctionDescriptor {
    extern_methods!(
        #[cfg(feature = "MTLFunctionStitching")]
        /// Sets the graph representing how to stitch functions together.
        #[unsafe(method(functionGraph))]
        #[unsafe(method_family = none)]
        pub fn functionGraph(&self) -> Option<Retained<MTLFunctionStitchingGraph>>;

        #[cfg(feature = "MTLFunctionStitching")]
        /// Setter for [`functionGraph`][Self::functionGraph].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setFunctionGraph:))]
        #[unsafe(method_family = none)]
        pub fn setFunctionGraph(&self, function_graph: Option<&MTLFunctionStitchingGraph>);

        /// Configures an array of function descriptors with references to functions that contribute to the stitching process.
        #[unsafe(method(functionDescriptors))]
        #[unsafe(method_family = none)]
        pub fn functionDescriptors(&self) -> Option<Retained<NSArray<MTL4FunctionDescriptor>>>;

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

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