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

use crate::*;

extern "C" {
    pub static MTLCaptureErrorDomain: &'static NSErrorDomain;
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCaptureError(pub NSInteger);
impl MTLCaptureError {
    #[doc(alias = "MTLCaptureErrorNotSupported")]
    pub const NotSupported: Self = Self(1);
    #[doc(alias = "MTLCaptureErrorAlreadyCapturing")]
    pub const AlreadyCapturing: Self = Self(2);
    #[doc(alias = "MTLCaptureErrorInvalidDescriptor")]
    pub const InvalidDescriptor: Self = Self(3);
}

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

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct MTLCaptureDestination(pub NSInteger);
impl MTLCaptureDestination {
    #[doc(alias = "MTLCaptureDestinationDeveloperTools")]
    pub const DeveloperTools: Self = Self(1);
    #[doc(alias = "MTLCaptureDestinationGPUTraceDocument")]
    pub const GPUTraceDocument: Self = Self(2);
}

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

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

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

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

unsafe impl NSCopying for MTLCaptureDescriptor {}

unsafe impl NSObjectProtocol for MTLCaptureDescriptor {}

extern_methods!(
    unsafe impl MTLCaptureDescriptor {
        #[method_id(@__retain_semantics Other captureObject)]
        pub unsafe fn captureObject(&self) -> Option<Retained<AnyObject>>;

        #[method(setCaptureObject:)]
        pub unsafe fn setCaptureObject(&self, capture_object: Option<&AnyObject>);

        #[method(destination)]
        pub fn destination(&self) -> MTLCaptureDestination;

        #[method(setDestination:)]
        pub fn setDestination(&self, destination: MTLCaptureDestination);

        #[method_id(@__retain_semantics Other outputURL)]
        pub fn outputURL(&self) -> Option<Retained<NSURL>>;

        #[method(setOutputURL:)]
        pub fn setOutputURL(&self, output_url: Option<&NSURL>);
    }
);

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

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

impl DefaultRetained for MTLCaptureDescriptor {
    #[inline]
    fn default_id() -> Retained<Self> {
        Self::new()
    }
}

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

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

unsafe impl NSObjectProtocol for MTLCaptureManager {}

extern_methods!(
    unsafe impl MTLCaptureManager {
        #[method_id(@__retain_semantics Other sharedCaptureManager)]
        pub unsafe fn sharedCaptureManager() -> Retained<MTLCaptureManager>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(all(feature = "MTLCaptureScope", feature = "MTLDevice"))]
        #[method_id(@__retain_semantics New newCaptureScopeWithDevice:)]
        pub fn newCaptureScopeWithDevice(
            &self,
            device: &ProtocolObject<dyn MTLDevice>,
        ) -> Retained<ProtocolObject<dyn MTLCaptureScope>>;

        #[cfg(all(feature = "MTLCaptureScope", feature = "MTLCommandQueue"))]
        #[method_id(@__retain_semantics New newCaptureScopeWithCommandQueue:)]
        pub fn newCaptureScopeWithCommandQueue(
            &self,
            command_queue: &ProtocolObject<dyn MTLCommandQueue>,
        ) -> Retained<ProtocolObject<dyn MTLCaptureScope>>;

        #[method(supportsDestination:)]
        pub fn supportsDestination(&self, destination: MTLCaptureDestination) -> bool;

        #[method(startCaptureWithDescriptor:error:_)]
        pub fn startCaptureWithDescriptor_error(
            &self,
            descriptor: &MTLCaptureDescriptor,
        ) -> Result<(), Retained<NSError>>;

        #[cfg(feature = "MTLDevice")]
        #[deprecated = "Use startCaptureWithDescriptor:error: instead"]
        #[method(startCaptureWithDevice:)]
        pub fn startCaptureWithDevice(&self, device: &ProtocolObject<dyn MTLDevice>);

        #[cfg(feature = "MTLCommandQueue")]
        #[deprecated = "Use startCaptureWithDescriptor:error: instead"]
        #[method(startCaptureWithCommandQueue:)]
        pub fn startCaptureWithCommandQueue(
            &self,
            command_queue: &ProtocolObject<dyn MTLCommandQueue>,
        );

        #[cfg(feature = "MTLCaptureScope")]
        #[deprecated = "Use startCaptureWithDescriptor:error: instead"]
        #[method(startCaptureWithScope:)]
        pub fn startCaptureWithScope(&self, capture_scope: &ProtocolObject<dyn MTLCaptureScope>);

        #[method(stopCapture)]
        pub fn stopCapture(&self);

        #[cfg(feature = "MTLCaptureScope")]
        #[method_id(@__retain_semantics Other defaultCaptureScope)]
        pub fn defaultCaptureScope(&self) -> Option<Retained<ProtocolObject<dyn MTLCaptureScope>>>;

        #[cfg(feature = "MTLCaptureScope")]
        #[method(setDefaultCaptureScope:)]
        pub fn setDefaultCaptureScope(
            &self,
            default_capture_scope: Option<&ProtocolObject<dyn MTLCaptureScope>>,
        );

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

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl MTLCaptureManager {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);
