//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLIndirectCommandType(pub NSUInteger);
bitflags::bitflags! {
    impl MTLIndirectCommandType: NSUInteger {
        #[doc(alias = "MTLIndirectCommandTypeDraw")]
        const Draw = 1<<0;
        #[doc(alias = "MTLIndirectCommandTypeDrawIndexed")]
        const DrawIndexed = 1<<1;
        #[doc(alias = "MTLIndirectCommandTypeDrawPatches")]
        const DrawPatches = 1<<2;
        #[doc(alias = "MTLIndirectCommandTypeDrawIndexedPatches")]
        const DrawIndexedPatches = 1<<3;
        #[doc(alias = "MTLIndirectCommandTypeConcurrentDispatch")]
        const ConcurrentDispatch = 1<<5;
        #[doc(alias = "MTLIndirectCommandTypeConcurrentDispatchThreads")]
        const ConcurrentDispatchThreads = 1<<6;
        #[doc(alias = "MTLIndirectCommandTypeDrawMeshThreadgroups")]
        const DrawMeshThreadgroups = 1<<7;
        #[doc(alias = "MTLIndirectCommandTypeDrawMeshThreads")]
        const DrawMeshThreads = 1<<8;
    }
}

unsafe impl Encode for MTLIndirectCommandType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for MTLIndirectCommandType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct MTLIndirectCommandBufferExecutionRange {
    pub location: u32,
    pub length: u32,
}

unsafe impl Encode for MTLIndirectCommandBufferExecutionRange {
    const ENCODING: Encoding = Encoding::Struct("?", &[<u32>::ENCODING, <u32>::ENCODING]);
}

unsafe impl RefEncode for MTLIndirectCommandBufferExecutionRange {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// TODO: pub fn MTLIndirectCommandBufferExecutionRangeMake(location: u32,length: u32,) -> MTLIndirectCommandBufferExecutionRange;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTLIndirectCommandBufferDescriptor;

    unsafe impl ClassType for MTLIndirectCommandBufferDescriptor {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSCopying for MTLIndirectCommandBufferDescriptor {}

unsafe impl NSObjectProtocol for MTLIndirectCommandBufferDescriptor {}

extern_methods!(
    unsafe impl MTLIndirectCommandBufferDescriptor {
        #[method(commandTypes)]
        pub fn commandTypes(&self) -> MTLIndirectCommandType;

        #[method(setCommandTypes:)]
        pub fn setCommandTypes(&self, command_types: MTLIndirectCommandType);

        #[method(inheritPipelineState)]
        pub fn inheritPipelineState(&self) -> bool;

        #[method(setInheritPipelineState:)]
        pub fn setInheritPipelineState(&self, inherit_pipeline_state: bool);

        #[method(inheritBuffers)]
        pub fn inheritBuffers(&self) -> bool;

        #[method(setInheritBuffers:)]
        pub fn setInheritBuffers(&self, inherit_buffers: bool);

        #[method(maxVertexBufferBindCount)]
        pub fn maxVertexBufferBindCount(&self) -> NSUInteger;

        #[method(setMaxVertexBufferBindCount:)]
        pub fn setMaxVertexBufferBindCount(&self, max_vertex_buffer_bind_count: NSUInteger);

        #[method(maxFragmentBufferBindCount)]
        pub fn maxFragmentBufferBindCount(&self) -> NSUInteger;

        #[method(setMaxFragmentBufferBindCount:)]
        pub fn setMaxFragmentBufferBindCount(&self, max_fragment_buffer_bind_count: NSUInteger);

        #[method(maxKernelBufferBindCount)]
        pub fn maxKernelBufferBindCount(&self) -> NSUInteger;

        #[method(setMaxKernelBufferBindCount:)]
        pub fn setMaxKernelBufferBindCount(&self, max_kernel_buffer_bind_count: NSUInteger);

        #[method(maxKernelThreadgroupMemoryBindCount)]
        pub unsafe fn maxKernelThreadgroupMemoryBindCount(&self) -> NSUInteger;

        #[method(setMaxKernelThreadgroupMemoryBindCount:)]
        pub unsafe fn setMaxKernelThreadgroupMemoryBindCount(
            &self,
            max_kernel_threadgroup_memory_bind_count: NSUInteger,
        );

        #[method(maxObjectBufferBindCount)]
        pub unsafe fn maxObjectBufferBindCount(&self) -> NSUInteger;

        #[method(setMaxObjectBufferBindCount:)]
        pub unsafe fn setMaxObjectBufferBindCount(&self, max_object_buffer_bind_count: NSUInteger);

        #[method(maxMeshBufferBindCount)]
        pub unsafe fn maxMeshBufferBindCount(&self) -> NSUInteger;

        #[method(setMaxMeshBufferBindCount:)]
        pub unsafe fn setMaxMeshBufferBindCount(&self, max_mesh_buffer_bind_count: NSUInteger);

        #[method(maxObjectThreadgroupMemoryBindCount)]
        pub unsafe fn maxObjectThreadgroupMemoryBindCount(&self) -> NSUInteger;

        #[method(setMaxObjectThreadgroupMemoryBindCount:)]
        pub unsafe fn setMaxObjectThreadgroupMemoryBindCount(
            &self,
            max_object_threadgroup_memory_bind_count: NSUInteger,
        );

        #[method(supportRayTracing)]
        pub unsafe fn supportRayTracing(&self) -> bool;

        #[method(setSupportRayTracing:)]
        pub unsafe fn setSupportRayTracing(&self, support_ray_tracing: bool);

        #[method(supportDynamicAttributeStride)]
        pub unsafe fn supportDynamicAttributeStride(&self) -> bool;

        #[method(setSupportDynamicAttributeStride:)]
        pub unsafe fn setSupportDynamicAttributeStride(
            &self,
            support_dynamic_attribute_stride: bool,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl MTLIndirectCommandBufferDescriptor {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_protocol!(
    #[cfg(feature = "MTLResource")]
    pub unsafe trait MTLIndirectCommandBuffer: MTLResource + IsRetainable {
        #[method(size)]
        fn size(&self) -> NSUInteger;

        #[cfg(feature = "MTLTypes")]
        #[method(gpuResourceID)]
        unsafe fn gpuResourceID(&self) -> MTLResourceID;

        #[method(resetWithRange:)]
        unsafe fn resetWithRange(&self, range: NSRange);

        #[cfg(feature = "MTLIndirectCommandEncoder")]
        #[method_id(@__retain_semantics Other indirectRenderCommandAtIndex:)]
        unsafe fn indirectRenderCommandAtIndex(
            &self,
            command_index: NSUInteger,
        ) -> Retained<ProtocolObject<dyn MTLIndirectRenderCommand>>;

        #[cfg(feature = "MTLIndirectCommandEncoder")]
        #[method_id(@__retain_semantics Other indirectComputeCommandAtIndex:)]
        unsafe fn indirectComputeCommandAtIndex(
            &self,
            command_index: NSUInteger,
        ) -> Retained<ProtocolObject<dyn MTLIndirectComputeCommand>>;
    }

    #[cfg(feature = "MTLResource")]
    unsafe impl ProtocolType for dyn MTLIndirectCommandBuffer {}
);
