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

/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsbundleexecutablearchitecturei386?language=objc)
pub const NSBundleExecutableArchitectureI386: c_uint = 0x00000007;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsbundleexecutablearchitectureppc?language=objc)
pub const NSBundleExecutableArchitecturePPC: c_uint = 0x00000012;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsbundleexecutablearchitecturex86_64?language=objc)
pub const NSBundleExecutableArchitectureX86_64: c_uint = 0x01000007;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsbundleexecutablearchitectureppc64?language=objc)
pub const NSBundleExecutableArchitecturePPC64: c_uint = 0x01000012;
/// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsbundleexecutablearchitecturearm64?language=objc)
pub const NSBundleExecutableArchitectureARM64: c_uint = 0x0100000c;

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

unsafe impl Send for NSBundle {}

unsafe impl Sync for NSBundle {}

unsafe impl NSObjectProtocol for NSBundle {}

impl NSBundle {
    extern_methods!(
        #[unsafe(method(mainBundle))]
        #[unsafe(method_family = none)]
        pub fn mainBundle() -> Retained<NSBundle>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(bundleWithPath:))]
        #[unsafe(method_family = none)]
        pub unsafe fn bundleWithPath(path: &NSString) -> Option<Retained<Self>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(initWithPath:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPath(
            this: Allocated<Self>,
            path: &NSString,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(bundleWithURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn bundleWithURL(url: &NSURL) -> Option<Retained<Self>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(initWithURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithURL(this: Allocated<Self>, url: &NSURL) -> Option<Retained<Self>>;

        #[unsafe(method(bundleForClass:))]
        #[unsafe(method_family = none)]
        pub unsafe fn bundleForClass(a_class: &AnyClass) -> Retained<NSBundle>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(bundleWithIdentifier:))]
        #[unsafe(method_family = none)]
        pub unsafe fn bundleWithIdentifier(identifier: &NSString) -> Option<Retained<NSBundle>>;

        #[cfg(feature = "NSArray")]
        #[unsafe(method(allBundles))]
        #[unsafe(method_family = none)]
        pub unsafe fn allBundles() -> Retained<NSArray<NSBundle>>;

        #[cfg(feature = "NSArray")]
        #[unsafe(method(allFrameworks))]
        #[unsafe(method_family = none)]
        pub unsafe fn allFrameworks() -> Retained<NSArray<NSBundle>>;

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

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

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

        #[cfg(feature = "NSError")]
        #[unsafe(method(preflightAndReturnError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn preflightAndReturnError(&self) -> Result<(), Retained<NSError>>;

        #[cfg(feature = "NSError")]
        #[unsafe(method(loadAndReturnError:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn loadAndReturnError(&self) -> Result<(), Retained<NSError>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(bundleURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn bundleURL(&self) -> Retained<NSURL>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(resourceURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn resourceURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(executableURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn executableURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(all(feature = "NSString", feature = "NSURL"))]
        #[unsafe(method(URLForAuxiliaryExecutable:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLForAuxiliaryExecutable(
            &self,
            executable_name: &NSString,
        ) -> Option<Retained<NSURL>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(privateFrameworksURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn privateFrameworksURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(sharedFrameworksURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedFrameworksURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(sharedSupportURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedSupportURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(builtInPlugInsURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn builtInPlugInsURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(feature = "NSURL")]
        #[unsafe(method(appStoreReceiptURL))]
        #[unsafe(method_family = none)]
        pub unsafe fn appStoreReceiptURL(&self) -> Option<Retained<NSURL>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(bundlePath))]
        #[unsafe(method_family = none)]
        pub unsafe fn bundlePath(&self) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(resourcePath))]
        #[unsafe(method_family = none)]
        pub unsafe fn resourcePath(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(executablePath))]
        #[unsafe(method_family = none)]
        pub unsafe fn executablePath(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(pathForAuxiliaryExecutable:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pathForAuxiliaryExecutable(
            &self,
            executable_name: &NSString,
        ) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(privateFrameworksPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn privateFrameworksPath(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(sharedFrameworksPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedFrameworksPath(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(sharedSupportPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn sharedSupportPath(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(builtInPlugInsPath))]
        #[unsafe(method_family = none)]
        pub unsafe fn builtInPlugInsPath(&self) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "NSString", feature = "NSURL"))]
        #[unsafe(method(URLForResource:withExtension:subdirectory:inBundleWithURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLForResource_withExtension_subdirectory_inBundleWithURL(
            name: Option<&NSString>,
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
            bundle_url: &NSURL,
        ) -> Option<Retained<NSURL>>;

        #[cfg(all(feature = "NSArray", feature = "NSString", feature = "NSURL"))]
        #[unsafe(method(URLsForResourcesWithExtension:subdirectory:inBundleWithURL:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLsForResourcesWithExtension_subdirectory_inBundleWithURL(
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
            bundle_url: &NSURL,
        ) -> Option<Retained<NSArray<NSURL>>>;

        #[cfg(all(feature = "NSString", feature = "NSURL"))]
        #[unsafe(method(URLForResource:withExtension:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLForResource_withExtension(
            &self,
            name: Option<&NSString>,
            ext: Option<&NSString>,
        ) -> Option<Retained<NSURL>>;

        #[cfg(all(feature = "NSString", feature = "NSURL"))]
        #[unsafe(method(URLForResource:withExtension:subdirectory:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLForResource_withExtension_subdirectory(
            &self,
            name: Option<&NSString>,
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
        ) -> Option<Retained<NSURL>>;

        #[cfg(all(feature = "NSString", feature = "NSURL"))]
        #[unsafe(method(URLForResource:withExtension:subdirectory:localization:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLForResource_withExtension_subdirectory_localization(
            &self,
            name: Option<&NSString>,
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
            localization_name: Option<&NSString>,
        ) -> Option<Retained<NSURL>>;

        #[cfg(all(feature = "NSArray", feature = "NSString", feature = "NSURL"))]
        #[unsafe(method(URLsForResourcesWithExtension:subdirectory:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLsForResourcesWithExtension_subdirectory(
            &self,
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
        ) -> Option<Retained<NSArray<NSURL>>>;

        #[cfg(all(feature = "NSArray", feature = "NSString", feature = "NSURL"))]
        #[unsafe(method(URLsForResourcesWithExtension:subdirectory:localization:))]
        #[unsafe(method_family = none)]
        pub unsafe fn URLsForResourcesWithExtension_subdirectory_localization(
            &self,
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
            localization_name: Option<&NSString>,
        ) -> Option<Retained<NSArray<NSURL>>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(pathForResource:ofType:inDirectory:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pathForResource_ofType_inDirectory_class(
            name: Option<&NSString>,
            ext: Option<&NSString>,
            bundle_path: &NSString,
        ) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(pathsForResourcesOfType:inDirectory:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pathsForResourcesOfType_inDirectory_class(
            ext: Option<&NSString>,
            bundle_path: &NSString,
        ) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(pathForResource:ofType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pathForResource_ofType(
            &self,
            name: Option<&NSString>,
            ext: Option<&NSString>,
        ) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(pathForResource:ofType:inDirectory:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pathForResource_ofType_inDirectory(
            &self,
            name: Option<&NSString>,
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
        ) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(pathForResource:ofType:inDirectory:forLocalization:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pathForResource_ofType_inDirectory_forLocalization(
            &self,
            name: Option<&NSString>,
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
            localization_name: Option<&NSString>,
        ) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(pathsForResourcesOfType:inDirectory:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pathsForResourcesOfType_inDirectory(
            &self,
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
        ) -> Retained<NSArray<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(pathsForResourcesOfType:inDirectory:forLocalization:))]
        #[unsafe(method_family = none)]
        pub unsafe fn pathsForResourcesOfType_inDirectory_forLocalization(
            &self,
            ext: Option<&NSString>,
            subpath: Option<&NSString>,
            localization_name: Option<&NSString>,
        ) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(localizedStringForKey:value:table:))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizedStringForKey_value_table(
            &self,
            key: &NSString,
            value: Option<&NSString>,
            table_name: Option<&NSString>,
        ) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(bundleIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn bundleIdentifier(&self) -> Option<Retained<NSString>>;

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

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

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

        #[cfg(feature = "NSString")]
        #[unsafe(method(classNamed:))]
        #[unsafe(method_family = none)]
        pub unsafe fn classNamed(&self, class_name: &NSString) -> Option<&'static AnyClass>;

        #[unsafe(method(principalClass))]
        #[unsafe(method_family = none)]
        pub unsafe fn principalClass(&self) -> Option<&'static AnyClass>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(preferredLocalizations))]
        #[unsafe(method_family = none)]
        pub unsafe fn preferredLocalizations(&self) -> Retained<NSArray<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(localizations))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizations(&self) -> Retained<NSArray<NSString>>;

        #[cfg(feature = "NSString")]
        #[unsafe(method(developmentLocalization))]
        #[unsafe(method_family = none)]
        pub unsafe fn developmentLocalization(&self) -> Option<Retained<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(preferredLocalizationsFromArray:))]
        #[unsafe(method_family = none)]
        pub unsafe fn preferredLocalizationsFromArray(
            localizations_array: &NSArray<NSString>,
        ) -> Retained<NSArray<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[unsafe(method(preferredLocalizationsFromArray:forPreferences:))]
        #[unsafe(method_family = none)]
        pub unsafe fn preferredLocalizationsFromArray_forPreferences(
            localizations_array: &NSArray<NSString>,
            preferences_array: Option<&NSArray<NSString>>,
        ) -> Retained<NSArray<NSString>>;

        #[cfg(all(feature = "NSArray", feature = "NSValue"))]
        #[unsafe(method(executableArchitectures))]
        #[unsafe(method_family = none)]
        pub unsafe fn executableArchitectures(&self) -> Option<Retained<NSArray<NSNumber>>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSBundle {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// NSBundleExtensionMethods.
#[cfg(feature = "NSString")]
impl NSString {
    extern_methods!(
        #[unsafe(method(variantFittingPresentationWidth:))]
        #[unsafe(method_family = none)]
        pub unsafe fn variantFittingPresentationWidth(
            &self,
            width: NSInteger,
        ) -> Retained<NSString>;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsbundledidloadnotification?language=objc)
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSBundleDidLoadNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsloadedclasses?language=objc)
    #[cfg(feature = "NSString")]
    pub static NSLoadedClasses: &'static NSString;
}

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

unsafe impl NSObjectProtocol for NSBundleResourceRequest {}

#[cfg(feature = "NSProgress")]
unsafe impl NSProgressReporting for NSBundleResourceRequest {}

impl NSBundleResourceRequest {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(all(feature = "NSSet", feature = "NSString"))]
        #[unsafe(method(initWithTags:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTags(this: Allocated<Self>, tags: &NSSet<NSString>)
            -> Retained<Self>;

        #[cfg(all(feature = "NSSet", feature = "NSString"))]
        #[unsafe(method(initWithTags:bundle:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithTags_bundle(
            this: Allocated<Self>,
            tags: &NSSet<NSString>,
            bundle: &NSBundle,
        ) -> Retained<Self>;

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

        /// Setter for [`loadingPriority`][Self::loadingPriority].
        #[unsafe(method(setLoadingPriority:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLoadingPriority(&self, loading_priority: c_double);

        #[cfg(all(feature = "NSSet", feature = "NSString"))]
        #[unsafe(method(tags))]
        #[unsafe(method_family = none)]
        pub unsafe fn tags(&self) -> Retained<NSSet<NSString>>;

        #[unsafe(method(bundle))]
        #[unsafe(method_family = none)]
        pub unsafe fn bundle(&self) -> Retained<NSBundle>;

        #[cfg(all(feature = "NSError", feature = "block2"))]
        #[unsafe(method(beginAccessingResourcesWithCompletionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn beginAccessingResourcesWithCompletionHandler(
            &self,
            completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
        );

        #[cfg(feature = "block2")]
        #[unsafe(method(conditionallyBeginAccessingResourcesWithCompletionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn conditionallyBeginAccessingResourcesWithCompletionHandler(
            &self,
            completion_handler: &block2::Block<dyn Fn(Bool)>,
        );

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

        #[cfg(feature = "NSProgress")]
        #[unsafe(method(progress))]
        #[unsafe(method_family = none)]
        pub unsafe fn progress(&self) -> Retained<NSProgress>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSBundleResourceRequest {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

/// NSBundleResourceRequestAdditions.
impl NSBundle {
    extern_methods!(
        #[cfg(all(feature = "NSSet", feature = "NSString"))]
        #[unsafe(method(setPreservationPriority:forTags:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPreservationPriority_forTags(
            &self,
            priority: c_double,
            tags: &NSSet<NSString>,
        );

        #[cfg(feature = "NSString")]
        #[unsafe(method(preservationPriorityForTag:))]
        #[unsafe(method_family = none)]
        pub unsafe fn preservationPriorityForTag(&self, tag: &NSString) -> c_double;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsbundleresourcerequestlowdiskspacenotification?language=objc)
    #[cfg(all(feature = "NSNotification", feature = "NSString"))]
    pub static NSBundleResourceRequestLowDiskSpaceNotification: &'static NSNotificationName;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsbundleresourcerequestloadingpriorityurgent?language=objc)
    pub static NSBundleResourceRequestLoadingPriorityUrgent: c_double;
}
