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

/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsbatchinsertrequestresulttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBatchInsertRequestResultType(pub NSUInteger);
impl NSBatchInsertRequestResultType {
    #[doc(alias = "NSBatchInsertRequestResultTypeStatusOnly")]
    pub const StatusOnly: Self = Self(0x0);
    #[doc(alias = "NSBatchInsertRequestResultTypeObjectIDs")]
    pub const ObjectIDs: Self = Self(0x1);
    #[doc(alias = "NSBatchInsertRequestResultTypeCount")]
    pub const Count: Self = Self(0x2);
}

unsafe impl Encode for NSBatchInsertRequestResultType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSBatchInsertRequestResultType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsbatchupdaterequestresulttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBatchUpdateRequestResultType(pub NSUInteger);
impl NSBatchUpdateRequestResultType {
    #[doc(alias = "NSStatusOnlyResultType")]
    pub const StatusOnlyResultType: Self = Self(0x0);
    #[doc(alias = "NSUpdatedObjectIDsResultType")]
    pub const UpdatedObjectIDsResultType: Self = Self(0x1);
    #[doc(alias = "NSUpdatedObjectsCountResultType")]
    pub const UpdatedObjectsCountResultType: Self = Self(0x2);
}

unsafe impl Encode for NSBatchUpdateRequestResultType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSBatchUpdateRequestResultType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsbatchdeleterequestresulttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBatchDeleteRequestResultType(pub NSUInteger);
impl NSBatchDeleteRequestResultType {
    #[doc(alias = "NSBatchDeleteResultTypeStatusOnly")]
    pub const ResultTypeStatusOnly: Self = Self(0x0);
    #[doc(alias = "NSBatchDeleteResultTypeObjectIDs")]
    pub const ResultTypeObjectIDs: Self = Self(0x1);
    #[doc(alias = "NSBatchDeleteResultTypeCount")]
    pub const ResultTypeCount: Self = Self(0x2);
}

unsafe impl Encode for NSBatchDeleteRequestResultType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSBatchDeleteRequestResultType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nspersistenthistoryresulttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPersistentHistoryResultType(pub NSInteger);
impl NSPersistentHistoryResultType {
    #[doc(alias = "NSPersistentHistoryResultTypeStatusOnly")]
    pub const StatusOnly: Self = Self(0x0);
    #[doc(alias = "NSPersistentHistoryResultTypeObjectIDs")]
    pub const ObjectIDs: Self = Self(0x1);
    #[doc(alias = "NSPersistentHistoryResultTypeCount")]
    pub const Count: Self = Self(0x2);
    #[doc(alias = "NSPersistentHistoryResultTypeTransactionsOnly")]
    pub const TransactionsOnly: Self = Self(0x3);
    #[doc(alias = "NSPersistentHistoryResultTypeChangesOnly")]
    pub const ChangesOnly: Self = Self(0x4);
    #[doc(alias = "NSPersistentHistoryResultTypeTransactionsAndChanges")]
    pub const TransactionsAndChanges: Self = Self(0x5);
}

unsafe impl Encode for NSPersistentHistoryResultType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSPersistentHistoryResultType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

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

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

impl NSPersistentStoreResult {
    extern_methods!();
}

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

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

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

impl NSPersistentStoreAsynchronousResult {
    extern_methods!(
        #[cfg(feature = "NSManagedObjectContext")]
        #[unsafe(method(managedObjectContext))]
        #[unsafe(method_family = none)]
        pub unsafe fn managedObjectContext(&self) -> Retained<NSManagedObjectContext>;

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

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

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

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

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsasynchronousfetchresult?language=objc)
    #[unsafe(super(NSPersistentStoreAsynchronousResult, NSPersistentStoreResult, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "NSFetchRequest")]
    pub struct NSAsynchronousFetchResult<ResultType: ?Sized = AnyObject>;
);

#[cfg(feature = "NSFetchRequest")]
impl<ResultType: ?Sized + Message + NSFetchRequestResult> NSAsynchronousFetchResult<ResultType> {
    /// Unchecked conversion of the generic parameter.
    ///
    /// # Safety
    ///
    /// The generic must be valid to reinterpret as the given type.
    #[inline]
    pub unsafe fn cast_unchecked<NewResultType: ?Sized + Message + NSFetchRequestResult>(
        &self,
    ) -> &NSAsynchronousFetchResult<NewResultType> {
        unsafe { &*((self as *const Self).cast()) }
    }
}

#[cfg(feature = "NSFetchRequest")]
extern_conformance!(
    unsafe impl<ResultType: ?Sized + NSFetchRequestResult> NSObjectProtocol
        for NSAsynchronousFetchResult<ResultType>
    {
    }
);

#[cfg(feature = "NSFetchRequest")]
impl<ResultType: Message + NSFetchRequestResult> NSAsynchronousFetchResult<ResultType> {
    extern_methods!(
        #[cfg(feature = "NSPersistentStoreRequest")]
        #[unsafe(method(fetchRequest))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchRequest(&self) -> Retained<NSAsynchronousFetchRequest<ResultType>>;

        #[unsafe(method(finalResult))]
        #[unsafe(method_family = none)]
        pub unsafe fn finalResult(&self) -> Option<Retained<NSArray<ResultType>>>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(feature = "NSFetchRequest")]
impl<ResultType: Message + NSFetchRequestResult> NSAsynchronousFetchResult<ResultType> {
    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>;
    );
}

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

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

impl NSBatchInsertResult {
    extern_methods!(
        #[unsafe(method(result))]
        #[unsafe(method_family = none)]
        pub unsafe fn result(&self) -> Option<Retained<AnyObject>>;

        #[unsafe(method(resultType))]
        #[unsafe(method_family = none)]
        pub unsafe fn resultType(&self) -> NSBatchInsertRequestResultType;
    );
}

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

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

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

impl NSBatchUpdateResult {
    extern_methods!(
        #[unsafe(method(result))]
        #[unsafe(method_family = none)]
        pub unsafe fn result(&self) -> Option<Retained<AnyObject>>;

        #[unsafe(method(resultType))]
        #[unsafe(method_family = none)]
        pub unsafe fn resultType(&self) -> NSBatchUpdateRequestResultType;
    );
}

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

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

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

impl NSBatchDeleteResult {
    extern_methods!(
        #[unsafe(method(result))]
        #[unsafe(method_family = none)]
        pub unsafe fn result(&self) -> Option<Retained<AnyObject>>;

        #[unsafe(method(resultType))]
        #[unsafe(method_family = none)]
        pub unsafe fn resultType(&self) -> NSBatchDeleteRequestResultType;
    );
}

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

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

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

impl NSPersistentHistoryResult {
    extern_methods!(
        #[unsafe(method(result))]
        #[unsafe(method_family = none)]
        pub unsafe fn result(&self) -> Option<Retained<AnyObject>>;

        #[unsafe(method(resultType))]
        #[unsafe(method_family = none)]
        pub unsafe fn resultType(&self) -> NSPersistentHistoryResultType;
    );
}

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

/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nspersistentcloudkitcontainereventresulttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPersistentCloudKitContainerEventResultType(pub NSInteger);
impl NSPersistentCloudKitContainerEventResultType {
    #[doc(alias = "NSPersistentCloudKitContainerEventResultTypeEvents")]
    pub const Events: Self = Self(0);
    #[doc(alias = "NSPersistentCloudKitContainerEventResultTypeCountEvents")]
    pub const CountEvents: Self = Self(1);
}

unsafe impl Encode for NSPersistentCloudKitContainerEventResultType {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSPersistentCloudKitContainerEventResultType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

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

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

impl NSPersistentCloudKitContainerEventResult {
    extern_methods!(
        #[unsafe(method(result))]
        #[unsafe(method_family = none)]
        pub unsafe fn result(&self) -> Option<Retained<AnyObject>>;

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

        #[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>;
    );
}
