//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::rc::{Allocated, Retained};
use objc2::runtime::ProtocolObject;
use objc2::{extern_class, extern_conformance, extern_methods};
use objc2_foundation::{
    CopyingHelper, NSArray, NSCopying, NSDictionary, NSObject, NSObjectProtocol, NSString,
};

use crate::*;

extern_class!(
    /// Groups together properties to drive a static linking process.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4staticlinkingdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4StaticLinkingDescriptor;
);

extern_conformance!(
    unsafe impl NSCopying for MTL4StaticLinkingDescriptor {}
);

unsafe impl CopyingHelper for MTL4StaticLinkingDescriptor {
    type Result = Self;
}

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

impl MTL4StaticLinkingDescriptor {
    extern_methods!(
        /// Provides an array of functions to link at the Metal IR level.
        #[unsafe(method(functionDescriptors))]
        #[unsafe(method_family = none)]
        pub fn function_descriptors(
            &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 set_function_descriptors(
            &self,
            function_descriptors: Option<&NSArray<MTL4FunctionDescriptor>>,
        );

        /// Provides an array of private functions to link at the Metal IR level.
        ///
        /// You specify private functions to link separately from ``functionDescriptors`` because pipelines don't export private functions as ``MTLFunctionHandle`` instances.
        /// - Note: You can link private functions even when your ``MTLDevice`` doesn't support function pointers.
        #[unsafe(method(privateFunctionDescriptors))]
        #[unsafe(method_family = none)]
        pub fn private_function_descriptors(
            &self,
        ) -> Option<Retained<NSArray<MTL4FunctionDescriptor>>>;

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

        /// Assigns groups of functions to match call-site attributes in shader code.
        ///
        /// Function groups help the compiler reduce the number of candidate functions it needs to evaluate for shader function calls, potentially increasing runtime performance.
        #[unsafe(method(groups))]
        #[unsafe(method_family = none)]
        pub fn groups(
            &self,
        ) -> Option<Retained<NSDictionary<NSString, NSArray<MTL4FunctionDescriptor>>>>;

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

/// Methods declared on superclass `NSObject`.
impl MTL4StaticLinkingDescriptor {
    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>;
    );
}

extern_class!(
    /// Groups together properties to drive the dynamic linking process of a pipeline stage.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4pipelinestagedynamiclinkingdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4PipelineStageDynamicLinkingDescriptor;
);

extern_conformance!(
    unsafe impl NSCopying for MTL4PipelineStageDynamicLinkingDescriptor {}
);

unsafe impl CopyingHelper for MTL4PipelineStageDynamicLinkingDescriptor {
    type Result = Self;
}

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

impl MTL4PipelineStageDynamicLinkingDescriptor {
    extern_methods!(
        /// Limits the maximum depth of the call stack for indirect function calls in the pipeline stage function.
        #[unsafe(method(maxCallStackDepth))]
        #[unsafe(method_family = none)]
        pub fn max_call_stack_depth(&self) -> usize;

        /// Setter for [`maxCallStackDepth`][Self::maxCallStackDepth].
        #[unsafe(method(setMaxCallStackDepth:))]
        #[unsafe(method_family = none)]
        pub fn set_max_call_stack_depth(&self, max_call_stack_depth: usize);

        /// Provides the array of binary functions to link.
        ///
        /// Binary functions are shader functions that you compile from Metal IR to machine code ahead of time
        /// using instances of ``MTL4Compiler``.
        #[unsafe(method(binaryLinkedFunctions))]
        #[unsafe(method_family = none)]
        pub fn binary_linked_functions(
            &self,
        ) -> Option<Retained<NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>>;

        /// Setter for [`binaryLinkedFunctions`][Self::binaryLinkedFunctions].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setBinaryLinkedFunctions:))]
        #[unsafe(method_family = none)]
        pub fn set_binary_linked_functions(
            &self,
            binary_linked_functions: Option<&NSArray<ProtocolObject<dyn MTL4BinaryFunction>>>,
        );

        /// Provides an array of dynamic libraries the compiler loads when it builds the pipeline.
        #[unsafe(method(preloadedLibraries))]
        #[unsafe(method_family = none)]
        pub fn preloaded_libraries(
            &self,
        ) -> Retained<NSArray<ProtocolObject<dyn MTLDynamicLibrary>>>;

        /// Setter for [`preloadedLibraries`][Self::preloadedLibraries].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setPreloadedLibraries:))]
        #[unsafe(method_family = none)]
        pub fn set_preloaded_libraries(
            &self,
            preloaded_libraries: &NSArray<ProtocolObject<dyn MTLDynamicLibrary>>,
        );
    );
}

/// Methods declared on superclass `NSObject`.
impl MTL4PipelineStageDynamicLinkingDescriptor {
    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>;
    );
}

extern_class!(
    /// Groups together properties that provide linking properties for render pipelines.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4renderpipelinedynamiclinkingdescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4RenderPipelineDynamicLinkingDescriptor;
);

extern_conformance!(
    unsafe impl NSCopying for MTL4RenderPipelineDynamicLinkingDescriptor {}
);

unsafe impl CopyingHelper for MTL4RenderPipelineDynamicLinkingDescriptor {
    type Result = Self;
}

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

impl MTL4RenderPipelineDynamicLinkingDescriptor {
    extern_methods!(
        /// Controls properties for linking the vertex stage of the render pipeline.
        #[unsafe(method(vertexLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn vertex_linking_descriptor(
            &self,
        ) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;

        /// Controls properties for linking the fragment stage of the render pipeline.
        #[unsafe(method(fragmentLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn fragment_linking_descriptor(
            &self,
        ) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;

        /// Controls properties for linking the tile stage of the render pipeline.
        #[unsafe(method(tileLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn tile_linking_descriptor(
            &self,
        ) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;

        /// Controls properties for link the object stage of the render pipeline.
        #[unsafe(method(objectLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn object_linking_descriptor(
            &self,
        ) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;

        /// Controls properties for linking the mesh stage of the render pipeline.
        #[unsafe(method(meshLinkingDescriptor))]
        #[unsafe(method_family = none)]
        pub fn mesh_linking_descriptor(
            &self,
        ) -> Retained<MTL4PipelineStageDynamicLinkingDescriptor>;
    );
}

/// Methods declared on superclass `NSObject`.
impl MTL4RenderPipelineDynamicLinkingDescriptor {
    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>;
    );
}
