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

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsnibname?language=objc)
pub type NSNibName = NSString;

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

extern_conformance!(
    unsafe impl NSCoding for NSNib {}
);

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

impl NSNib {
    extern_methods!(
        #[unsafe(method(initWithNibNamed:bundle:))]
        #[unsafe(method_family = init)]
        pub fn initWithNibNamed_bundle(
            this: Allocated<Self>,
            nib_name: &NSNibName,
            bundle: Option<&NSBundle>,
        ) -> Option<Retained<Self>>;

        #[unsafe(method(initWithNibData:bundle:))]
        #[unsafe(method_family = init)]
        pub fn initWithNibData_bundle(
            this: Allocated<Self>,
            nib_data: &NSData,
            bundle: Option<&NSBundle>,
        ) -> Retained<Self>;
    );
}

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

/// NSDeprecated.
impl NSNib {
    extern_methods!(
        /// # Safety
        ///
        /// `nib_file_url` might not allow `None`.
        #[deprecated]
        #[unsafe(method(initWithContentsOfURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentsOfURL(
            this: Allocated<Self>,
            nib_file_url: Option<&NSURL>,
        ) -> Option<Retained<Self>>;

        /// # Safety
        ///
        /// - `external_name_table` generic should be of the correct type.
        /// - `external_name_table` might not allow `None`.
        #[deprecated]
        #[unsafe(method(instantiateNibWithExternalNameTable:))]
        #[unsafe(method_family = none)]
        pub unsafe fn instantiateNibWithExternalNameTable(
            &self,
            external_name_table: Option<&NSDictionary>,
        ) -> bool;

        /// # Safety
        ///
        /// - `owner` should be of the correct type.
        /// - `owner` might not allow `None`.
        /// - `top_level_objects` generic should be of the correct type.
        /// - `top_level_objects` might not allow `None`.
        #[deprecated]
        #[unsafe(method(instantiateNibWithOwner:topLevelObjects:))]
        #[unsafe(method_family = none)]
        pub unsafe fn instantiateNibWithOwner_topLevelObjects(
            &self,
            owner: Option<&AnyObject>,
            top_level_objects: Option<&mut Option<Retained<NSArray>>>,
        ) -> bool;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsnibowner?language=objc)
    #[deprecated]
    pub static NSNibOwner: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsnibtoplevelobjects?language=objc)
    #[deprecated]
    pub static NSNibTopLevelObjects: &'static NSString;
}
