//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nspersistenthistorychangetype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPersistentHistoryChangeType(pub NSInteger);
impl NSPersistentHistoryChangeType {
    #[doc(alias = "NSPersistentHistoryChangeTypeInsert")]
    pub const Insert: Self = Self(0);
    #[doc(alias = "NSPersistentHistoryChangeTypeUpdate")]
    pub const Update: Self = Self(1);
    #[doc(alias = "NSPersistentHistoryChangeTypeDelete")]
    pub const Delete: Self = Self(2);
}

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

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

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

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

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

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

impl NSPersistentHistoryChange {
    extern_methods!(
        #[cfg(all(feature = "NSEntityDescription", feature = "NSManagedObjectContext"))]
        #[unsafe(method(entityDescriptionWithContext:))]
        #[unsafe(method_family = none)]
        pub unsafe fn entityDescriptionWithContext(
            context: &NSManagedObjectContext,
        ) -> Option<Retained<NSEntityDescription>>;

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

        #[cfg(all(feature = "NSFetchRequest", feature = "NSPersistentStoreRequest"))]
        #[unsafe(method(fetchRequest))]
        #[unsafe(method_family = none)]
        pub unsafe fn fetchRequest() -> Option<Retained<NSFetchRequest>>;

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

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

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

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

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

        #[cfg(feature = "NSPropertyDescription")]
        #[unsafe(method(updatedProperties))]
        #[unsafe(method_family = none)]
        pub unsafe fn updatedProperties(&self) -> Option<Retained<NSSet<NSPropertyDescription>>>;
    );
}

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