1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// NS_ENUM
#[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!(
    /// Methods declared on superclass `NSObject`
    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!(
    /// Methods declared on superclass `NSObject`
    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!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSMergePolicy {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);