use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSMergePolicyType(pub NSUInteger);
impl NSMergePolicyType {
pub const NSErrorMergePolicyType: Self = Self(0x00);
pub const NSMergeByPropertyStoreTrumpMergePolicyType: Self = Self(0x01);
pub const NSMergeByPropertyObjectTrumpMergePolicyType: Self = Self(0x02);
pub const NSOverwriteMergePolicyType: Self = Self(0x03);
pub const NSRollbackMergePolicyType: Self = Self(0x04);
}
unsafe impl Encode for NSMergePolicyType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSMergePolicyType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMergeConflict;
unsafe impl ClassType for NSMergeConflict {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSMergeConflict {}
extern_methods!(
unsafe impl NSMergeConflict {
#[cfg(feature = "NSManagedObject")]
#[method_id(@__retain_semantics Other sourceObject)]
pub unsafe fn sourceObject(&self) -> Retained<NSManagedObject>;
#[method_id(@__retain_semantics Other objectSnapshot)]
pub unsafe fn objectSnapshot(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[method_id(@__retain_semantics Other cachedSnapshot)]
pub unsafe fn cachedSnapshot(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[method_id(@__retain_semantics Other persistedSnapshot)]
pub unsafe fn persistedSnapshot(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[method(newVersionNumber)]
pub unsafe fn newVersionNumber(&self) -> NSUInteger;
#[method(oldVersionNumber)]
pub unsafe fn oldVersionNumber(&self) -> NSUInteger;
#[cfg(feature = "NSManagedObject")]
#[method_id(@__retain_semantics Init initWithSource:newVersion:oldVersion:cachedSnapshot:persistedSnapshot:)]
pub unsafe fn initWithSource_newVersion_oldVersion_cachedSnapshot_persistedSnapshot(
this: Allocated<Self>,
src_object: &NSManagedObject,
newvers: NSUInteger,
oldvers: NSUInteger,
cachesnap: Option<&NSDictionary<NSString, AnyObject>>,
persnap: Option<&NSDictionary<NSString, AnyObject>>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
unsafe impl NSMergeConflict {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSConstraintConflict;
unsafe impl ClassType for NSConstraintConflict {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSConstraintConflict {}
extern_methods!(
unsafe impl NSConstraintConflict {
#[method_id(@__retain_semantics Other constraint)]
pub unsafe fn constraint(&self) -> Retained<NSArray<NSString>>;
#[method_id(@__retain_semantics Other constraintValues)]
pub unsafe fn constraintValues(&self) -> Retained<NSDictionary<NSString, AnyObject>>;
#[cfg(feature = "NSManagedObject")]
#[method_id(@__retain_semantics Other databaseObject)]
pub unsafe fn databaseObject(&self) -> Option<Retained<NSManagedObject>>;
#[method_id(@__retain_semantics Other databaseSnapshot)]
pub unsafe fn databaseSnapshot(
&self,
) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;
#[cfg(feature = "NSManagedObject")]
#[method_id(@__retain_semantics Other conflictingObjects)]
pub unsafe fn conflictingObjects(&self) -> Retained<NSArray<NSManagedObject>>;
#[method_id(@__retain_semantics Other conflictingSnapshots)]
pub unsafe fn conflictingSnapshots(&self) -> Retained<NSArray<NSDictionary>>;
#[cfg(feature = "NSManagedObject")]
#[method_id(@__retain_semantics Init initWithConstraint:databaseObject:databaseSnapshot:conflictingObjects:conflictingSnapshots:)]
pub unsafe fn initWithConstraint_databaseObject_databaseSnapshot_conflictingObjects_conflictingSnapshots(
this: Allocated<Self>,
contraint: &NSArray<NSString>,
database_object: Option<&NSManagedObject>,
database_snapshot: Option<&NSDictionary>,
conflicting_objects: &NSArray<NSManagedObject>,
conflicting_snapshots: &NSArray,
) -> Retained<Self>;
}
);
extern_methods!(
unsafe impl NSConstraintConflict {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMergePolicy;
unsafe impl ClassType for NSMergePolicy {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSMergePolicy {}
extern_methods!(
unsafe impl NSMergePolicy {
#[method_id(@__retain_semantics Other errorMergePolicy)]
pub unsafe fn errorMergePolicy() -> Retained<NSMergePolicy>;
#[method_id(@__retain_semantics Other rollbackMergePolicy)]
pub unsafe fn rollbackMergePolicy() -> Retained<NSMergePolicy>;
#[method_id(@__retain_semantics Other overwriteMergePolicy)]
pub unsafe fn overwriteMergePolicy() -> Retained<NSMergePolicy>;
#[method_id(@__retain_semantics Other mergeByPropertyObjectTrumpMergePolicy)]
pub unsafe fn mergeByPropertyObjectTrumpMergePolicy() -> Retained<NSMergePolicy>;
#[method_id(@__retain_semantics Other mergeByPropertyStoreTrumpMergePolicy)]
pub unsafe fn mergeByPropertyStoreTrumpMergePolicy() -> Retained<NSMergePolicy>;
#[method(mergeType)]
pub unsafe fn mergeType(&self) -> NSMergePolicyType;
#[method_id(@__retain_semantics Init initWithMergeType:)]
pub unsafe fn initWithMergeType(
this: Allocated<Self>,
ty: NSMergePolicyType,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method(resolveConflicts:error:_)]
pub unsafe fn resolveConflicts_error(
&self,
list: &NSArray,
) -> Result<(), Retained<NSError>>;
#[method(resolveOptimisticLockingVersionConflicts:error:_)]
pub unsafe fn resolveOptimisticLockingVersionConflicts_error(
&self,
list: &NSArray<NSMergeConflict>,
) -> Result<(), Retained<NSError>>;
#[method(resolveConstraintConflicts:error:_)]
pub unsafe fn resolveConstraintConflicts_error(
&self,
list: &NSArray<NSConstraintConflict>,
) -> Result<(), Retained<NSError>>;
}
);
extern_methods!(
unsafe impl NSMergePolicy {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);