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

#[cfg(feature = "NSPersistentStoreRequest")]
extern_conformance!(
    unsafe impl NSCopying for NSBatchInsertRequest {}
);

#[cfg(feature = "NSPersistentStoreRequest")]
unsafe impl CopyingHelper for NSBatchInsertRequest {
    type Result = Self;
}

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

#[cfg(feature = "NSPersistentStoreRequest")]
impl NSBatchInsertRequest {
    extern_methods!(
        #[unsafe(method(entityName))]
        #[unsafe(method_family = none)]
        pub unsafe fn entityName(&self) -> Retained<NSString>;

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

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

        /// Setter for [`objectsToInsert`][Self::objectsToInsert].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `objects_to_insert` generic generic should be of the correct type.
        #[unsafe(method(setObjectsToInsert:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setObjectsToInsert(
            &self,
            objects_to_insert: Option<&NSArray<NSDictionary<NSString, AnyObject>>>,
        );

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// The returned block's argument must be a valid pointer.
        #[unsafe(method(dictionaryHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn dictionaryHandler(
            &self,
        ) -> *mut block2::DynBlock<dyn Fn(NonNull<NSMutableDictionary<NSString, AnyObject>>) -> Bool>;

        #[cfg(feature = "block2")]
        /// Setter for [`dictionaryHandler`][Self::dictionaryHandler].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        ///
        /// # Safety
        ///
        /// `dictionary_handler` block's argument generic should be of the correct type.
        #[unsafe(method(setDictionaryHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setDictionaryHandler(
            &self,
            dictionary_handler: Option<
                &block2::DynBlock<
                    dyn Fn(NonNull<NSMutableDictionary<NSString, AnyObject>>) -> Bool,
                >,
            >,
        );

        #[cfg(all(feature = "NSManagedObject", feature = "block2"))]
        /// # Safety
        ///
        /// The returned block's argument must be a valid pointer.
        #[unsafe(method(managedObjectHandler))]
        #[unsafe(method_family = none)]
        pub unsafe fn managedObjectHandler(
            &self,
        ) -> *mut block2::DynBlock<dyn Fn(NonNull<NSManagedObject>) -> Bool>;

        #[cfg(all(feature = "NSManagedObject", feature = "block2"))]
        /// Setter for [`managedObjectHandler`][Self::managedObjectHandler].
        ///
        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
        #[unsafe(method(setManagedObjectHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setManagedObjectHandler(
            &self,
            managed_object_handler: Option<
                &block2::DynBlock<dyn Fn(NonNull<NSManagedObject>) -> Bool>,
            >,
        );

        #[cfg(feature = "NSPersistentStoreResult")]
        #[unsafe(method(resultType))]
        #[unsafe(method_family = none)]
        pub unsafe fn resultType(&self) -> NSBatchInsertRequestResultType;

        #[cfg(feature = "NSPersistentStoreResult")]
        /// Setter for [`resultType`][Self::resultType].
        #[unsafe(method(setResultType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setResultType(&self, result_type: NSBatchInsertRequestResultType);

        /// # Safety
        ///
        /// `dictionaries` generic generic should be of the correct type.
        #[unsafe(method(batchInsertRequestWithEntityName:objects:))]
        #[unsafe(method_family = none)]
        pub unsafe fn batchInsertRequestWithEntityName_objects(
            entity_name: &NSString,
            dictionaries: &NSArray<NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `handler` block's argument generic should be of the correct type.
        #[unsafe(method(batchInsertRequestWithEntityName:dictionaryHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn batchInsertRequestWithEntityName_dictionaryHandler(
            entity_name: &NSString,
            handler: &block2::DynBlock<
                dyn Fn(NonNull<NSMutableDictionary<NSString, AnyObject>>) -> Bool,
            >,
        ) -> Retained<Self>;

        #[cfg(all(feature = "NSManagedObject", feature = "block2"))]
        #[unsafe(method(batchInsertRequestWithEntityName:managedObjectHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn batchInsertRequestWithEntityName_managedObjectHandler(
            entity_name: &NSString,
            handler: &block2::DynBlock<dyn Fn(NonNull<NSManagedObject>) -> Bool>,
        ) -> Retained<Self>;

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

        /// # Safety
        ///
        /// `dictionaries` generic generic should be of the correct type.
        #[unsafe(method(initWithEntityName:objects:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithEntityName_objects(
            this: Allocated<Self>,
            entity_name: &NSString,
            dictionaries: &NSArray<NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[cfg(feature = "NSEntityDescription")]
        /// # Safety
        ///
        /// `dictionaries` generic generic should be of the correct type.
        #[unsafe(method(initWithEntity:objects:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithEntity_objects(
            this: Allocated<Self>,
            entity: &NSEntityDescription,
            dictionaries: &NSArray<NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "NSEntityDescription", feature = "block2"))]
        /// # Safety
        ///
        /// `handler` block's argument generic should be of the correct type.
        #[unsafe(method(initWithEntity:dictionaryHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithEntity_dictionaryHandler(
            this: Allocated<Self>,
            entity: &NSEntityDescription,
            handler: &block2::DynBlock<
                dyn Fn(NonNull<NSMutableDictionary<NSString, AnyObject>>) -> Bool,
            >,
        ) -> Retained<Self>;

        #[cfg(all(
            feature = "NSEntityDescription",
            feature = "NSManagedObject",
            feature = "block2"
        ))]
        #[unsafe(method(initWithEntity:managedObjectHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithEntity_managedObjectHandler(
            this: Allocated<Self>,
            entity: &NSEntityDescription,
            handler: &block2::DynBlock<dyn Fn(NonNull<NSManagedObject>) -> Bool>,
        ) -> Retained<Self>;

        #[cfg(feature = "block2")]
        /// # Safety
        ///
        /// `handler` block's argument generic should be of the correct type.
        #[unsafe(method(initWithEntityName:dictionaryHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithEntityName_dictionaryHandler(
            this: Allocated<Self>,
            entity_name: &NSString,
            handler: &block2::DynBlock<
                dyn Fn(NonNull<NSMutableDictionary<NSString, AnyObject>>) -> Bool,
            >,
        ) -> Retained<Self>;

        #[cfg(all(feature = "NSManagedObject", feature = "block2"))]
        #[unsafe(method(initWithEntityName:managedObjectHandler:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithEntityName_managedObjectHandler(
            this: Allocated<Self>,
            entity_name: &NSString,
            handler: &block2::DynBlock<dyn Fn(NonNull<NSManagedObject>) -> Bool>,
        ) -> Retained<Self>;
    );
}

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