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

extern_class!(
    /// Serves as the base descriptor for creating a Metal library.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4librarydescriptor?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct MTL4LibraryDescriptor;
);

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

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

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

impl MTL4LibraryDescriptor {
    extern_methods!(
        /// Assigns an optional string containing the source code of the shader language program to compile into a
        /// Metal library.
        #[unsafe(method(source))]
        #[unsafe(method_family = none)]
        pub fn source(&self) -> Option<Retained<NSString>>;

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

        #[cfg(feature = "MTLLibrary")]
        /// Provides compile-time options for the Metal library.
        #[unsafe(method(options))]
        #[unsafe(method_family = none)]
        pub fn options(&self) -> Option<Retained<MTLCompileOptions>>;

        #[cfg(feature = "MTLLibrary")]
        /// Setter for [`options`][Self::options].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setOptions:))]
        #[unsafe(method_family = none)]
        pub fn setOptions(&self, options: Option<&MTLCompileOptions>);

        /// Assigns an optional name to the Metal library.
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub fn name(&self) -> Option<Retained<NSString>>;

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

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