//! 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/nsmigrationmanager?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSMigrationManager;
);

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

impl NSMigrationManager {
    extern_methods!(
        #[cfg(feature = "NSManagedObjectModel")]
        #[unsafe(method(initWithSourceModel:destinationModel:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSourceModel_destinationModel(
            this: Allocated<Self>,
            source_model: &NSManagedObjectModel,
            destination_model: &NSManagedObjectModel,
        ) -> Retained<Self>;

        #[cfg(feature = "NSMappingModel")]
        /// # Safety
        ///
        /// - `s_options` generic should be of the correct type.
        /// - `d_options` generic should be of the correct type.
        #[unsafe(method(migrateStoreFromURL:type:options:withMappingModel:toDestinationURL:destinationType:destinationOptions:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn migrateStoreFromURL_type_options_withMappingModel_toDestinationURL_destinationType_destinationOptions_error(
            &self,
            source_url: &NSURL,
            s_store_type: &NSString,
            s_options: Option<&NSDictionary>,
            mappings: Option<&NSMappingModel>,
            d_url: &NSURL,
            d_store_type: &NSString,
            d_options: Option<&NSDictionary>,
        ) -> Result<(), Retained<NSError>>;

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

        /// Setter for [`usesStoreSpecificMigrationManager`][Self::usesStoreSpecificMigrationManager].
        #[unsafe(method(setUsesStoreSpecificMigrationManager:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUsesStoreSpecificMigrationManager(
            &self,
            uses_store_specific_migration_manager: bool,
        );

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

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

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

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

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

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

        #[cfg(all(feature = "NSEntityDescription", feature = "NSEntityMapping"))]
        #[unsafe(method(sourceEntityForEntityMapping:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sourceEntityForEntityMapping(
            &self,
            m_entity: &NSEntityMapping,
        ) -> Option<Retained<NSEntityDescription>>;

        #[cfg(all(feature = "NSEntityDescription", feature = "NSEntityMapping"))]
        #[unsafe(method(destinationEntityForEntityMapping:))]
        #[unsafe(method_family = none)]
        pub unsafe fn destinationEntityForEntityMapping(
            &self,
            m_entity: &NSEntityMapping,
        ) -> Option<Retained<NSEntityDescription>>;

        #[cfg(all(feature = "NSEntityMapping", feature = "NSManagedObject"))]
        #[unsafe(method(associateSourceInstance:withDestinationInstance:forEntityMapping:))]
        #[unsafe(method_family = none)]
        pub unsafe fn associateSourceInstance_withDestinationInstance_forEntityMapping(
            &self,
            source_instance: &NSManagedObject,
            destination_instance: &NSManagedObject,
            entity_mapping: &NSEntityMapping,
        );

        #[cfg(feature = "NSManagedObject")]
        #[unsafe(method(destinationInstancesForEntityMappingNamed:sourceInstances:))]
        #[unsafe(method_family = none)]
        pub unsafe fn destinationInstancesForEntityMappingNamed_sourceInstances(
            &self,
            mapping_name: &NSString,
            source_instances: Option<&NSArray<NSManagedObject>>,
        ) -> Retained<NSArray<NSManagedObject>>;

        #[cfg(feature = "NSManagedObject")]
        #[unsafe(method(sourceInstancesForEntityMappingNamed:destinationInstances:))]
        #[unsafe(method_family = none)]
        pub unsafe fn sourceInstancesForEntityMappingNamed_destinationInstances(
            &self,
            mapping_name: &NSString,
            destination_instances: Option<&NSArray<NSManagedObject>>,
        ) -> Retained<NSArray<NSManagedObject>>;

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

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

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

        /// Setter for [`userInfo`][Self::userInfo].
        ///
        /// # Safety
        ///
        /// `user_info` generic should be of the correct type.
        #[unsafe(method(setUserInfo:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setUserInfo(&self, user_info: Option<&NSDictionary>);

        #[unsafe(method(cancelMigrationWithError:))]
        #[unsafe(method_family = none)]
        pub unsafe fn cancelMigrationWithError(&self, error: &NSError);
    );
}

/// Methods declared on superclass `NSObject`.
impl NSMigrationManager {
    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>;
    );
}
