//! 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/nsatomicstore?language=objc)
    #[unsafe(super(NSPersistentStore, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSPersistentStore")]
    pub struct NSAtomicStore;
);

#[cfg(feature = "NSPersistentStore")]
extern_conformance!(
    unsafe impl NSObjectProtocol for NSAtomicStore {}
);

#[cfg(feature = "NSPersistentStore")]
impl NSAtomicStore {
    extern_methods!(
        #[cfg(feature = "NSPersistentStoreCoordinator")]
        /// # Safety
        ///
        /// `options` generic should be of the correct type.
        #[unsafe(method(initWithPersistentStoreCoordinator:configurationName:URL:options:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithPersistentStoreCoordinator_configurationName_URL_options(
            this: Allocated<Self>,
            coordinator: Option<&NSPersistentStoreCoordinator>,
            configuration_name: Option<&NSString>,
            url: &NSURL,
            options: Option<&NSDictionary>,
        ) -> Retained<Self>;

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

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

        #[cfg(all(feature = "NSAtomicStoreCacheNode", feature = "NSManagedObject"))]
        #[unsafe(method(newCacheNodeForManagedObject:))]
        #[unsafe(method_family = new)]
        pub unsafe fn newCacheNodeForManagedObject(
            &self,
            managed_object: &NSManagedObject,
        ) -> Retained<NSAtomicStoreCacheNode>;

        #[cfg(all(feature = "NSAtomicStoreCacheNode", feature = "NSManagedObject"))]
        #[unsafe(method(updateCacheNode:fromManagedObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateCacheNode_fromManagedObject(
            &self,
            node: &NSAtomicStoreCacheNode,
            managed_object: &NSManagedObject,
        );

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

        #[cfg(feature = "NSAtomicStoreCacheNode")]
        #[unsafe(method(addCacheNodes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addCacheNodes(&self, cache_nodes: &NSSet<NSAtomicStoreCacheNode>);

        #[cfg(feature = "NSAtomicStoreCacheNode")]
        #[unsafe(method(willRemoveCacheNodes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn willRemoveCacheNodes(&self, cache_nodes: &NSSet<NSAtomicStoreCacheNode>);

        #[cfg(all(feature = "NSAtomicStoreCacheNode", feature = "NSManagedObjectID"))]
        #[unsafe(method(cacheNodeForObjectID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn cacheNodeForObjectID(
            &self,
            object_id: &NSManagedObjectID,
        ) -> Option<Retained<NSAtomicStoreCacheNode>>;

        #[cfg(all(feature = "NSEntityDescription", feature = "NSManagedObjectID"))]
        /// # Safety
        ///
        /// `data` should be of the correct type.
        #[unsafe(method(objectIDForEntity:referenceObject:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectIDForEntity_referenceObject(
            &self,
            entity: &NSEntityDescription,
            data: &AnyObject,
        ) -> Retained<NSManagedObjectID>;

        #[cfg(feature = "NSManagedObject")]
        #[unsafe(method(newReferenceObjectForManagedObject:))]
        #[unsafe(method_family = new)]
        pub unsafe fn newReferenceObjectForManagedObject(
            &self,
            managed_object: &NSManagedObject,
        ) -> Retained<AnyObject>;

        #[cfg(feature = "NSManagedObjectID")]
        #[unsafe(method(referenceObjectForObjectID:))]
        #[unsafe(method_family = none)]
        pub unsafe fn referenceObjectForObjectID(
            &self,
            object_id: &NSManagedObjectID,
        ) -> Retained<AnyObject>;
    );
}

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

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