//! 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::*;
#[cfg(feature = "objc2-foundation")]
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykey?language=objc)
// NS_TYPED_ENUM
#[cfg(feature = "objc2-foundation")]
pub type IOSurfacePropertyKey = NSString;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyallocsize?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyAllocSize: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeywidth?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyWidth: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyheight?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyHeight: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeybytesperrow?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyBytesPerRow: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeybytesperelement?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyBytesPerElement: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyelementwidth?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyElementWidth: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyelementheight?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyElementHeight: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyoffset?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyOffset: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplaneinfo?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneInfo: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplanewidth?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneWidth: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplaneheight?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneHeight: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplanebytesperrow?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneBytesPerRow: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplaneoffset?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneOffset: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplanesize?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneSize: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplanebase?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneBase: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplanebytesperelement?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneBytesPerElement: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplaneelementwidth?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneElementWidth: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyplaneelementheight?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPlaneElementHeight: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeycachemode?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyCacheMode: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeypixelformat?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPixelFormat: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeypixelsizecastingallowed?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyPixelSizeCastingAllowed: &'static IOSurfacePropertyKey;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertykeyname?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyKeyName: &'static IOSurfacePropertyKey;
}

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurface?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct IOSurface;
);

#[cfg(feature = "objc2-foundation")]
extern_conformance!(
    unsafe impl NSCoding for IOSurface {}
);

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

#[cfg(feature = "objc2-foundation")]
extern_conformance!(
    unsafe impl NSSecureCoding for IOSurface {}
);

impl IOSurface {
    extern_methods!(
        #[cfg(feature = "objc2-foundation")]
        #[unsafe(method(initWithProperties:))]
        #[unsafe(method_family = init)]
        pub fn initWithProperties(
            this: Allocated<Self>,
            properties: &NSDictionary<IOSurfacePropertyKey, AnyObject>,
        ) -> Option<Retained<Self>>;

        #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
        #[unsafe(method(lockWithOptions:seed:))]
        #[unsafe(method_family = none)]
        pub fn lockWithOptions_seed(
            &self,
            options: IOSurfaceLockOptions,
            seed: *mut u32,
        ) -> libc::kern_return_t;

        #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
        #[unsafe(method(unlockWithOptions:seed:))]
        #[unsafe(method_family = none)]
        pub fn unlockWithOptions_seed(
            &self,
            options: IOSurfaceLockOptions,
            seed: *mut u32,
        ) -> libc::kern_return_t;

        #[unsafe(method(allocationSize))]
        #[unsafe(method_family = none)]
        pub fn allocationSize(&self) -> NSInteger;

        #[unsafe(method(width))]
        #[unsafe(method_family = none)]
        pub fn width(&self) -> NSInteger;

        #[unsafe(method(height))]
        #[unsafe(method_family = none)]
        pub fn height(&self) -> NSInteger;

        #[unsafe(method(baseAddress))]
        #[unsafe(method_family = none)]
        pub fn baseAddress(&self) -> NonNull<c_void>;

        #[unsafe(method(pixelFormat))]
        #[unsafe(method_family = none)]
        pub fn pixelFormat(&self) -> OSType;

        #[unsafe(method(bytesPerRow))]
        #[unsafe(method_family = none)]
        pub fn bytesPerRow(&self) -> NSInteger;

        #[unsafe(method(bytesPerElement))]
        #[unsafe(method_family = none)]
        pub fn bytesPerElement(&self) -> NSInteger;

        #[unsafe(method(elementWidth))]
        #[unsafe(method_family = none)]
        pub fn elementWidth(&self) -> NSInteger;

        #[unsafe(method(elementHeight))]
        #[unsafe(method_family = none)]
        pub fn elementHeight(&self) -> NSInteger;

        #[unsafe(method(surfaceID))]
        #[unsafe(method_family = none)]
        pub fn surfaceID(&self) -> u32;

        #[unsafe(method(seed))]
        #[unsafe(method_family = none)]
        pub fn seed(&self) -> u32;

        #[unsafe(method(planeCount))]
        #[unsafe(method_family = none)]
        pub fn planeCount(&self) -> NSUInteger;

        #[unsafe(method(widthOfPlaneAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn widthOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;

        #[unsafe(method(heightOfPlaneAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn heightOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;

        #[unsafe(method(bytesPerRowOfPlaneAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn bytesPerRowOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;

        #[unsafe(method(bytesPerElementOfPlaneAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn bytesPerElementOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;

        #[unsafe(method(elementWidthOfPlaneAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn elementWidthOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;

        #[unsafe(method(elementHeightOfPlaneAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn elementHeightOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NSInteger;

        #[unsafe(method(baseAddressOfPlaneAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn baseAddressOfPlaneAtIndex(&self, plane_index: NSUInteger) -> NonNull<c_void>;

        #[cfg(feature = "objc2-foundation")]
        #[unsafe(method(setAttachment:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAttachment_forKey(&self, an_object: &AnyObject, key: &NSString);

        #[cfg(feature = "objc2-foundation")]
        #[unsafe(method(attachmentForKey:))]
        #[unsafe(method_family = none)]
        pub fn attachmentForKey(&self, key: &NSString) -> Option<Retained<AnyObject>>;

        #[cfg(feature = "objc2-foundation")]
        #[unsafe(method(removeAttachmentForKey:))]
        #[unsafe(method_family = none)]
        pub fn removeAttachmentForKey(&self, key: &NSString);

        #[cfg(feature = "objc2-foundation")]
        #[unsafe(method(setAllAttachments:))]
        #[unsafe(method_family = none)]
        pub fn setAllAttachments(&self, dict: &NSDictionary<NSString, AnyObject>);

        #[cfg(feature = "objc2-foundation")]
        #[unsafe(method(allAttachments))]
        #[unsafe(method_family = none)]
        pub fn allAttachments(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[unsafe(method(removeAllAttachments))]
        #[unsafe(method_family = none)]
        pub fn removeAllAttachments(&self);

        #[unsafe(method(isInUse))]
        #[unsafe(method_family = none)]
        pub fn isInUse(&self) -> bool;

        #[unsafe(method(incrementUseCount))]
        #[unsafe(method_family = none)]
        pub fn incrementUseCount(&self);

        #[unsafe(method(decrementUseCount))]
        #[unsafe(method_family = none)]
        pub fn decrementUseCount(&self);

        #[unsafe(method(localUseCount))]
        #[unsafe(method_family = none)]
        pub fn localUseCount(&self) -> i32;

        #[unsafe(method(allowsPixelSizeCasting))]
        #[unsafe(method_family = none)]
        pub fn allowsPixelSizeCasting(&self) -> bool;

        #[cfg(all(feature = "IOSurfaceTypes", feature = "libc"))]
        #[unsafe(method(setPurgeable:oldState:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPurgeable_oldState(
            &self,
            new_state: IOSurfacePurgeabilityState,
            old_state: *mut IOSurfacePurgeabilityState,
        ) -> libc::kern_return_t;
    );
}

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

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/iosurface/iosurfacepropertyallocsizekey?language=objc)
    #[cfg(feature = "objc2-foundation")]
    pub static IOSurfacePropertyAllocSizeKey: &'static IOSurfacePropertyKey;
}
