//! 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!(
    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsmanagedobjectmodel?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSManagedObjectModel;
);

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

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

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

extern_conformance!(
    unsafe impl NSFastEnumeration for NSManagedObjectModel {}
);

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

impl NSManagedObjectModel {
    extern_methods!(
        #[unsafe(method(mergedModelFromBundles:))]
        #[unsafe(method_family = none)]
        pub unsafe fn mergedModelFromBundles(
            bundles: Option<&NSArray<NSBundle>>,
        ) -> Option<Retained<NSManagedObjectModel>>;

        #[unsafe(method(modelByMergingModels:))]
        #[unsafe(method_family = none)]
        pub unsafe fn modelByMergingModels(
            models: Option<&NSArray<NSManagedObjectModel>>,
        ) -> Option<Retained<NSManagedObjectModel>>;

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

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

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

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

        #[cfg(feature = "NSEntityDescription")]
        /// Setter for [`entities`][Self::entities].
        #[unsafe(method(setEntities:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setEntities(&self, entities: &NSArray<NSEntityDescription>);

        #[unsafe(method(configurations))]
        #[unsafe(method_family = none)]
        pub unsafe fn configurations(&self) -> Retained<NSArray<NSString>>;

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

        #[cfg(feature = "NSEntityDescription")]
        #[unsafe(method(setEntities:forConfiguration:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setEntities_forConfiguration(
            &self,
            entities: &NSArray<NSEntityDescription>,
            configuration: &NSString,
        );

        #[cfg(all(feature = "NSFetchRequest", feature = "NSPersistentStoreRequest"))]
        /// # Safety
        ///
        /// `fetch_request_template` generic should be bound by `NSFetchRequestResult`.
        #[unsafe(method(setFetchRequestTemplate:forName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setFetchRequestTemplate_forName(
            &self,
            fetch_request_template: Option<&NSFetchRequest>,
            name: &NSString,
        );

        #[cfg(all(feature = "NSFetchRequest", feature = "NSPersistentStoreRequest"))]
        #[unsafe(method(fetchRequestTemplateForName:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchRequestTemplateForName(
            &self,
            name: &NSString,
        ) -> Option<Retained<NSFetchRequest>>;

        #[cfg(all(feature = "NSFetchRequest", feature = "NSPersistentStoreRequest"))]
        /// # Safety
        ///
        /// `variables` generic should be of the correct type.
        #[unsafe(method(fetchRequestFromTemplateWithName:substitutionVariables:))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchRequestFromTemplateWithName_substitutionVariables(
            &self,
            name: &NSString,
            variables: &NSDictionary<NSString, AnyObject>,
        ) -> Option<Retained<NSFetchRequest>>;

        #[unsafe(method(localizationDictionary))]
        #[unsafe(method_family = none)]
        pub unsafe fn localizationDictionary(
            &self,
        ) -> Option<Retained<NSDictionary<NSString, NSString>>>;

        /// Setter for [`localizationDictionary`][Self::localizationDictionary].
        #[unsafe(method(setLocalizationDictionary:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLocalizationDictionary(
            &self,
            localization_dictionary: Option<&NSDictionary<NSString, NSString>>,
        );

        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[unsafe(method(mergedModelFromBundles:forStoreMetadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn mergedModelFromBundles_forStoreMetadata(
            bundles: Option<&NSArray<NSBundle>>,
            metadata: &NSDictionary<NSString, AnyObject>,
        ) -> Option<Retained<NSManagedObjectModel>>;

        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[unsafe(method(modelByMergingModels:forStoreMetadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn modelByMergingModels_forStoreMetadata(
            models: &NSArray<NSManagedObjectModel>,
            metadata: &NSDictionary<NSString, AnyObject>,
        ) -> Option<Retained<NSManagedObjectModel>>;

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

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

        /// Setter for [`versionIdentifiers`][Self::versionIdentifiers].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `version_identifiers` generic should be of the correct type.
        #[unsafe(method(setVersionIdentifiers:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVersionIdentifiers(&self, version_identifiers: &NSSet);

        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[unsafe(method(isConfiguration:compatibleWithStoreMetadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isConfiguration_compatibleWithStoreMetadata(
            &self,
            configuration: Option<&NSString>,
            metadata: &NSDictionary<NSString, AnyObject>,
        ) -> bool;

        #[unsafe(method(entityVersionHashesByName))]
        #[unsafe(method_family = none)]
        pub unsafe fn entityVersionHashesByName(&self) -> Retained<NSDictionary<NSString, NSData>>;

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

        #[unsafe(method(checksumsForVersionedModelAtURL:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn checksumsForVersionedModelAtURL_error(
            model_url: &NSURL,
        ) -> Result<Retained<NSDictionary<NSString, NSString>>, Retained<NSError>>;
    );
}

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