//! 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::*;

/// Option mask for requesting reflection information at pipeline build time.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4shaderreflection?language=objc)
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTL4ShaderReflection(pub NSUInteger);
bitflags::bitflags! {
    impl MTL4ShaderReflection: NSUInteger {
/// Requests no information.
        #[doc(alias = "MTL4ShaderReflectionNone")]
        const None = 0;
/// Requests reflection information for bindings.
        #[doc(alias = "MTL4ShaderReflectionBindingInfo")]
        const BindingInfo = 1<<0;
/// Requests reflection information for buffer types.
        #[doc(alias = "MTL4ShaderReflectionBufferTypeInfo")]
        const BufferTypeInfo = 1<<1;
    }
}

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

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

/// Enumeration for controlling alpha-to-one state of a pipeline state object.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4alphatoonestate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTL4AlphaToOneState(pub NSInteger);
impl MTL4AlphaToOneState {
    /// Disables alpha-to-one.
    #[doc(alias = "MTL4AlphaToOneStateDisabled")]
    pub const Disabled: Self = Self(0);
    /// Enables alpha-to-one.
    #[doc(alias = "MTL4AlphaToOneStateEnabled")]
    pub const Enabled: Self = Self(1);
}

unsafe impl Encode for MTL4AlphaToOneState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// Enumeration for controlling alpha-to-coverage state of a pipeline state object.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4alphatocoveragestate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTL4AlphaToCoverageState(pub NSInteger);
impl MTL4AlphaToCoverageState {
    /// Disables alpha-to-coverage.
    #[doc(alias = "MTL4AlphaToCoverageStateDisabled")]
    pub const Disabled: Self = Self(0);
    /// Enables alpha-to-coverage.
    #[doc(alias = "MTL4AlphaToCoverageStateEnabled")]
    pub const Enabled: Self = Self(1);
}

unsafe impl Encode for MTL4AlphaToCoverageState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// Enumeration for controlling the blend state of a pipeline state object.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4blendstate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTL4BlendState(pub NSInteger);
impl MTL4BlendState {
    /// Disables blending.
    #[doc(alias = "MTL4BlendStateDisabled")]
    pub const Disabled: Self = Self(0);
    /// Enables blending.
    #[doc(alias = "MTL4BlendStateEnabled")]
    pub const Enabled: Self = Self(1);
    /// Defers determining the blending stage.
    ///
    /// Behaves as ``MTL4BlendStateDisabled`` until you specialize this pipeline value.
    #[doc(alias = "MTL4BlendStateUnspecialized")]
    pub const Unspecialized: Self = Self(2);
}

unsafe impl Encode for MTL4BlendState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

/// Enumeration for controlling support for ``MTLIndirectCommandBuffer``.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4indirectcommandbuffersupportstate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTL4IndirectCommandBufferSupportState(pub NSInteger);
impl MTL4IndirectCommandBufferSupportState {
    /// Disables support for indirect command buffers.
    #[doc(alias = "MTL4IndirectCommandBufferSupportStateDisabled")]
    pub const Disabled: Self = Self(0);
    /// Enables support for indirect command buffers.
    #[doc(alias = "MTL4IndirectCommandBufferSupportStateEnabled")]
    pub const Enabled: Self = Self(1);
}

unsafe impl Encode for MTL4IndirectCommandBufferSupportState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

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

extern_class!(
    /// Provides options controlling how to compile a pipeline state.
    ///
    /// You provide these options through the ``MTL4PipelineDescriptor`` class at compilation time.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4pipelineoptions?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4PipelineOptions;
);

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

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

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

impl MTL4PipelineOptions {
    extern_methods!(
        #[cfg(feature = "MTLPipeline")]
        /// Controls whether to enable or disable Metal Shader Validation for the pipeline.
        #[unsafe(method(shaderValidation))]
        #[unsafe(method_family = none)]
        pub fn shaderValidation(&self) -> MTLShaderValidation;

        #[cfg(feature = "MTLPipeline")]
        /// Setter for [`shaderValidation`][Self::shaderValidation].
        #[unsafe(method(setShaderValidation:))]
        #[unsafe(method_family = none)]
        pub fn setShaderValidation(&self, shader_validation: MTLShaderValidation);

        /// Controls whether to include Metal shader reflection in this pipeline.
        #[unsafe(method(shaderReflection))]
        #[unsafe(method_family = none)]
        pub fn shaderReflection(&self) -> MTL4ShaderReflection;

        /// Setter for [`shaderReflection`][Self::shaderReflection].
        #[unsafe(method(setShaderReflection:))]
        #[unsafe(method_family = none)]
        pub fn setShaderReflection(&self, shader_reflection: MTL4ShaderReflection);
    );
}

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

extern_class!(
    /// Base type for descriptors you use for building pipeline state objects.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4pipelinedescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4PipelineDescriptor;
);

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

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

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

impl MTL4PipelineDescriptor {
    extern_methods!(
        /// Assigns an optional string that uniquely identifies a pipeline descriptor.
        ///
        /// After you provide this label, you can use it to look up a pipeline state object by name in a binary archive.
        #[unsafe(method(label))]
        #[unsafe(method_family = none)]
        pub fn label(&self) -> Option<Retained<NSString>>;

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

        /// Provides compile-time options when you build the pipeline.
        #[unsafe(method(options))]
        #[unsafe(method_family = none)]
        pub fn options(&self) -> Option<Retained<MTL4PipelineOptions>>;

        /// Setter for [`options`][Self::options].
        #[unsafe(method(setOptions:))]
        #[unsafe(method_family = none)]
        pub fn setOptions(&self, options: Option<&MTL4PipelineOptions>);
    );
}

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