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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CKSyncEngine;

    unsafe impl ClassType for CKSyncEngine {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKSyncEngine {}

unsafe impl Sync for CKSyncEngine {}

unsafe impl NSObjectProtocol for CKSyncEngine {}

extern_methods!(
    unsafe impl CKSyncEngine {
        #[cfg(feature = "CKSyncEngineConfiguration")]
        #[method_id(@__retain_semantics Init initWithConfiguration:)]
        pub unsafe fn initWithConfiguration(
            this: Allocated<Self>,
            configuration: &CKSyncEngineConfiguration,
        ) -> Retained<Self>;

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

        #[cfg(feature = "CKDatabase")]
        #[method_id(@__retain_semantics Other database)]
        pub unsafe fn database(&self) -> Retained<CKDatabase>;

        #[cfg(feature = "CKSyncEngineState")]
        #[method_id(@__retain_semantics Other state)]
        pub unsafe fn state(&self) -> Retained<CKSyncEngineState>;

        #[cfg(feature = "block2")]
        #[method(fetchChangesWithCompletionHandler:)]
        pub unsafe fn fetchChangesWithCompletionHandler(
            &self,
            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        #[method(fetchChangesWithOptions:completionHandler:)]
        pub unsafe fn fetchChangesWithOptions_completionHandler(
            &self,
            options: &CKSyncEngineFetchChangesOptions,
            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        #[method(sendChangesWithCompletionHandler:)]
        pub unsafe fn sendChangesWithCompletionHandler(
            &self,
            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        #[method(sendChangesWithOptions:completionHandler:)]
        pub unsafe fn sendChangesWithOptions_completionHandler(
            &self,
            options: &CKSyncEngineSendChangesOptions,
            completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
        );

        #[cfg(feature = "block2")]
        #[method(cancelOperationsWithCompletionHandler:)]
        pub unsafe fn cancelOperationsWithCompletionHandler(
            &self,
            completion_handler: Option<&block2::Block<dyn Fn()>>,
        );
    }
);

extern_protocol!(
    pub unsafe trait CKSyncEngineDelegate: NSObjectProtocol {
        #[cfg(feature = "CKSyncEngineEvent")]
        #[method(syncEngine:handleEvent:)]
        unsafe fn syncEngine_handleEvent(
            &self,
            sync_engine: &CKSyncEngine,
            event: &CKSyncEngineEvent,
        );

        #[cfg(feature = "CKSyncEngineRecordZoneChangeBatch")]
        #[method_id(@__retain_semantics Other syncEngine:nextRecordZoneChangeBatchForContext:)]
        unsafe fn syncEngine_nextRecordZoneChangeBatchForContext(
            &self,
            sync_engine: &CKSyncEngine,
            context: &CKSyncEngineSendChangesContext,
        ) -> Option<Retained<CKSyncEngineRecordZoneChangeBatch>>;

        #[optional]
        #[method_id(@__retain_semantics Other syncEngine:nextFetchChangesOptionsForContext:)]
        unsafe fn syncEngine_nextFetchChangesOptionsForContext(
            &self,
            sync_engine: &CKSyncEngine,
            context: &CKSyncEngineFetchChangesContext,
        ) -> Retained<CKSyncEngineFetchChangesOptions>;
    }

    unsafe impl ProtocolType for dyn CKSyncEngineDelegate {}
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CKSyncEngineFetchChangesOptions;

    unsafe impl ClassType for CKSyncEngineFetchChangesOptions {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKSyncEngineFetchChangesOptions {}

unsafe impl Sync for CKSyncEngineFetchChangesOptions {}

unsafe impl NSCopying for CKSyncEngineFetchChangesOptions {}

unsafe impl NSObjectProtocol for CKSyncEngineFetchChangesOptions {}

extern_methods!(
    unsafe impl CKSyncEngineFetchChangesOptions {
        #[method_id(@__retain_semantics Other scope)]
        pub unsafe fn scope(&self) -> Retained<CKSyncEngineFetchChangesScope>;

        #[method(setScope:)]
        pub unsafe fn setScope(&self, scope: &CKSyncEngineFetchChangesScope);

        #[cfg(feature = "CKOperationGroup")]
        #[method_id(@__retain_semantics Other operationGroup)]
        pub unsafe fn operationGroup(&self) -> Retained<CKOperationGroup>;

        #[cfg(feature = "CKOperationGroup")]
        #[method(setOperationGroup:)]
        pub unsafe fn setOperationGroup(&self, operation_group: &CKOperationGroup);

        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Other prioritizedZoneIDs)]
        pub unsafe fn prioritizedZoneIDs(&self) -> Retained<NSArray<CKRecordZoneID>>;

        #[cfg(feature = "CKRecordZoneID")]
        #[method(setPrioritizedZoneIDs:)]
        pub unsafe fn setPrioritizedZoneIDs(&self, prioritized_zone_i_ds: &NSArray<CKRecordZoneID>);

        #[method_id(@__retain_semantics Init initWithScope:)]
        pub unsafe fn initWithScope(
            this: Allocated<Self>,
            scope: Option<&CKSyncEngineFetchChangesScope>,
        ) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl CKSyncEngineFetchChangesOptions {
        #[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 CKSyncEngineFetchChangesScope;

    unsafe impl ClassType for CKSyncEngineFetchChangesScope {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKSyncEngineFetchChangesScope {}

unsafe impl Sync for CKSyncEngineFetchChangesScope {}

unsafe impl NSCopying for CKSyncEngineFetchChangesScope {}

unsafe impl NSObjectProtocol for CKSyncEngineFetchChangesScope {}

extern_methods!(
    unsafe impl CKSyncEngineFetchChangesScope {
        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Other zoneIDs)]
        pub unsafe fn zoneIDs(&self) -> Option<Retained<NSSet<CKRecordZoneID>>>;

        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Other excludedZoneIDs)]
        pub unsafe fn excludedZoneIDs(&self) -> Retained<NSSet<CKRecordZoneID>>;

        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Init initWithZoneIDs:)]
        pub unsafe fn initWithZoneIDs(
            this: Allocated<Self>,
            zone_i_ds: Option<&NSSet<CKRecordZoneID>>,
        ) -> Retained<Self>;

        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Init initWithExcludedZoneIDs:)]
        pub unsafe fn initWithExcludedZoneIDs(
            this: Allocated<Self>,
            zone_i_ds: &NSSet<CKRecordZoneID>,
        ) -> Retained<Self>;

        #[cfg(feature = "CKRecordZoneID")]
        #[method(containsZoneID:)]
        pub unsafe fn containsZoneID(&self, zone_id: &CKRecordZoneID) -> bool;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl CKSyncEngineFetchChangesScope {
        #[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 CKSyncEngineSendChangesOptions;

    unsafe impl ClassType for CKSyncEngineSendChangesOptions {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKSyncEngineSendChangesOptions {}

unsafe impl Sync for CKSyncEngineSendChangesOptions {}

unsafe impl NSCopying for CKSyncEngineSendChangesOptions {}

unsafe impl NSObjectProtocol for CKSyncEngineSendChangesOptions {}

extern_methods!(
    unsafe impl CKSyncEngineSendChangesOptions {
        #[method_id(@__retain_semantics Other scope)]
        pub unsafe fn scope(&self) -> Retained<CKSyncEngineSendChangesScope>;

        #[method(setScope:)]
        pub unsafe fn setScope(&self, scope: &CKSyncEngineSendChangesScope);

        #[cfg(feature = "CKOperationGroup")]
        #[method_id(@__retain_semantics Other operationGroup)]
        pub unsafe fn operationGroup(&self) -> Retained<CKOperationGroup>;

        #[cfg(feature = "CKOperationGroup")]
        #[method(setOperationGroup:)]
        pub unsafe fn setOperationGroup(&self, operation_group: &CKOperationGroup);

        #[method_id(@__retain_semantics Init initWithScope:)]
        pub unsafe fn initWithScope(
            this: Allocated<Self>,
            scope: Option<&CKSyncEngineSendChangesScope>,
        ) -> Retained<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl CKSyncEngineSendChangesOptions {
        #[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 CKSyncEngineSendChangesScope;

    unsafe impl ClassType for CKSyncEngineSendChangesScope {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKSyncEngineSendChangesScope {}

unsafe impl Sync for CKSyncEngineSendChangesScope {}

unsafe impl NSCopying for CKSyncEngineSendChangesScope {}

unsafe impl NSObjectProtocol for CKSyncEngineSendChangesScope {}

extern_methods!(
    unsafe impl CKSyncEngineSendChangesScope {
        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Other zoneIDs)]
        pub unsafe fn zoneIDs(&self) -> Option<Retained<NSSet<CKRecordZoneID>>>;

        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Other excludedZoneIDs)]
        pub unsafe fn excludedZoneIDs(&self) -> Retained<NSSet<CKRecordZoneID>>;

        #[cfg(feature = "CKRecordID")]
        #[method_id(@__retain_semantics Other recordIDs)]
        pub unsafe fn recordIDs(&self) -> Option<Retained<NSSet<CKRecordID>>>;

        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Init initWithZoneIDs:)]
        pub unsafe fn initWithZoneIDs(
            this: Allocated<Self>,
            zone_i_ds: Option<&NSSet<CKRecordZoneID>>,
        ) -> Retained<Self>;

        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Init initWithExcludedZoneIDs:)]
        pub unsafe fn initWithExcludedZoneIDs(
            this: Allocated<Self>,
            excluded_zone_i_ds: &NSSet<CKRecordZoneID>,
        ) -> Retained<Self>;

        #[cfg(feature = "CKRecordID")]
        #[method_id(@__retain_semantics Init initWithRecordIDs:)]
        pub unsafe fn initWithRecordIDs(
            this: Allocated<Self>,
            record_i_ds: Option<&NSSet<CKRecordID>>,
        ) -> Retained<Self>;

        #[cfg(feature = "CKRecordID")]
        #[method(containsRecordID:)]
        pub unsafe fn containsRecordID(&self, record_id: &CKRecordID) -> bool;

        #[cfg(feature = "CKSyncEngineState")]
        #[method(containsPendingRecordZoneChange:)]
        pub unsafe fn containsPendingRecordZoneChange(
            &self,
            pending_record_zone_change: &CKSyncEnginePendingRecordZoneChange,
        ) -> bool;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl CKSyncEngineSendChangesScope {
        #[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>;
    }
);

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CKSyncEngineSyncReason(pub NSInteger);
impl CKSyncEngineSyncReason {
    #[doc(alias = "CKSyncEngineSyncReasonScheduled")]
    pub const Scheduled: Self = Self(0);
    #[doc(alias = "CKSyncEngineSyncReasonManual")]
    pub const Manual: Self = Self(1);
}

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

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

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CKSyncEngineFetchChangesContext;

    unsafe impl ClassType for CKSyncEngineFetchChangesContext {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKSyncEngineFetchChangesContext {}

unsafe impl Sync for CKSyncEngineFetchChangesContext {}

unsafe impl NSObjectProtocol for CKSyncEngineFetchChangesContext {}

extern_methods!(
    unsafe impl CKSyncEngineFetchChangesContext {
        #[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>;

        #[method(reason)]
        pub unsafe fn reason(&self) -> CKSyncEngineSyncReason;

        #[method_id(@__retain_semantics Other options)]
        pub unsafe fn options(&self) -> Retained<CKSyncEngineFetchChangesOptions>;
    }
);

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CKSyncEngineSendChangesContext;

    unsafe impl ClassType for CKSyncEngineSendChangesContext {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKSyncEngineSendChangesContext {}

unsafe impl Sync for CKSyncEngineSendChangesContext {}

unsafe impl NSObjectProtocol for CKSyncEngineSendChangesContext {}

extern_methods!(
    unsafe impl CKSyncEngineSendChangesContext {
        #[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>;

        #[method(reason)]
        pub unsafe fn reason(&self) -> CKSyncEngineSyncReason;

        #[method_id(@__retain_semantics Other options)]
        pub unsafe fn options(&self) -> Retained<CKSyncEngineSendChangesOptions>;
    }
);