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
//! 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 CKNotificationID;

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

unsafe impl NSCoding for CKNotificationID {}

unsafe impl NSCopying for CKNotificationID {}

unsafe impl NSObjectProtocol for CKNotificationID {}

unsafe impl NSSecureCoding for CKNotificationID {}

extern_methods!(
    unsafe impl CKNotificationID {}
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl CKNotificationID {
        #[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 CKNotificationType(pub NSInteger);
impl CKNotificationType {
    #[doc(alias = "CKNotificationTypeQuery")]
    pub const Query: Self = Self(1);
    #[doc(alias = "CKNotificationTypeRecordZone")]
    pub const RecordZone: Self = Self(2);
    #[doc(alias = "CKNotificationTypeReadNotification")]
    pub const ReadNotification: Self = Self(3);
    #[doc(alias = "CKNotificationTypeDatabase")]
    pub const Database: Self = Self(4);
}

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

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

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

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

unsafe impl Send for CKNotification {}

unsafe impl Sync for CKNotification {}

unsafe impl NSObjectProtocol for CKNotification {}

extern_methods!(
    unsafe impl CKNotification {
        #[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_id(@__retain_semantics Other notificationFromRemoteNotificationDictionary:)]
        pub unsafe fn notificationFromRemoteNotificationDictionary(
            notification_dictionary: &NSDictionary,
        ) -> Option<Retained<Self>>;

        #[method(notificationType)]
        pub unsafe fn notificationType(&self) -> CKNotificationType;

        #[method_id(@__retain_semantics Other notificationID)]
        pub unsafe fn notificationID(&self) -> Option<Retained<CKNotificationID>>;

        #[method_id(@__retain_semantics Other containerIdentifier)]
        pub unsafe fn containerIdentifier(&self) -> Option<Retained<NSString>>;

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

        #[method(isPruned)]
        pub unsafe fn isPruned(&self) -> bool;

        #[cfg(feature = "CKSubscription")]
        #[method_id(@__retain_semantics Other subscriptionID)]
        pub unsafe fn subscriptionID(&self) -> Option<Retained<CKSubscriptionID>>;
    }
);

extern_methods!(
    /// DeprecatedAPSProperties
    unsafe impl CKNotification {
        #[deprecated = "Interact with UI elements of a CloudKit-server-generated push message via UserNotifications.framework"]
        #[method_id(@__retain_semantics Other alertBody)]
        pub unsafe fn alertBody(&self) -> Option<Retained<NSString>>;

        #[deprecated = "Interact with UI elements of a CloudKit-server-generated push message via UserNotifications.framework"]
        #[method_id(@__retain_semantics Other alertLocalizationKey)]
        pub unsafe fn alertLocalizationKey(&self) -> Option<Retained<NSString>>;

        #[deprecated = "Interact with UI elements of a CloudKit-server-generated push message via UserNotifications.framework"]
        #[method_id(@__retain_semantics Other alertLocalizationArgs)]
        pub unsafe fn alertLocalizationArgs(&self) -> Option<Retained<NSArray<NSString>>>;

        #[method_id(@__retain_semantics Other title)]
        pub unsafe fn title(&self) -> Option<Retained<NSString>>;

        #[method_id(@__retain_semantics Other titleLocalizationKey)]
        pub unsafe fn titleLocalizationKey(&self) -> Option<Retained<NSString>>;

        #[method_id(@__retain_semantics Other titleLocalizationArgs)]
        pub unsafe fn titleLocalizationArgs(&self) -> Option<Retained<NSArray<NSString>>>;

        #[method_id(@__retain_semantics Other subtitle)]
        pub unsafe fn subtitle(&self) -> Option<Retained<NSString>>;

        #[method_id(@__retain_semantics Other subtitleLocalizationKey)]
        pub unsafe fn subtitleLocalizationKey(&self) -> Option<Retained<NSString>>;

        #[method_id(@__retain_semantics Other subtitleLocalizationArgs)]
        pub unsafe fn subtitleLocalizationArgs(&self) -> Option<Retained<NSArray<NSString>>>;

        #[deprecated = "Interact with UI elements of a CloudKit-server-generated push message via UserNotifications.framework"]
        #[method_id(@__retain_semantics Other alertActionLocalizationKey)]
        pub unsafe fn alertActionLocalizationKey(&self) -> Option<Retained<NSString>>;

        #[deprecated = "Interact with UI elements of a CloudKit-server-generated push message via UserNotifications.framework"]
        #[method_id(@__retain_semantics Other alertLaunchImage)]
        pub unsafe fn alertLaunchImage(&self) -> Option<Retained<NSString>>;

        #[deprecated = "Interact with UI elements of a CloudKit-server-generated push message via UserNotifications.framework"]
        #[method_id(@__retain_semantics Other badge)]
        pub unsafe fn badge(&self) -> Option<Retained<NSNumber>>;

        #[deprecated = "Interact with UI elements of a CloudKit-server-generated push message via UserNotifications.framework"]
        #[method_id(@__retain_semantics Other soundName)]
        pub unsafe fn soundName(&self) -> Option<Retained<NSString>>;

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct CKQueryNotificationReason(pub NSInteger);
impl CKQueryNotificationReason {
    #[doc(alias = "CKQueryNotificationReasonRecordCreated")]
    pub const RecordCreated: Self = Self(1);
    #[doc(alias = "CKQueryNotificationReasonRecordUpdated")]
    pub const RecordUpdated: Self = Self(2);
    #[doc(alias = "CKQueryNotificationReasonRecordDeleted")]
    pub const RecordDeleted: Self = Self(3);
}

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

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

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

    unsafe impl ClassType for CKQueryNotification {
        #[inherits(NSObject)]
        type Super = CKNotification;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKQueryNotification {}

unsafe impl Sync for CKQueryNotification {}

unsafe impl NSObjectProtocol for CKQueryNotification {}

extern_methods!(
    unsafe impl CKQueryNotification {
        #[method(queryNotificationReason)]
        pub unsafe fn queryNotificationReason(&self) -> CKQueryNotificationReason;

        #[method_id(@__retain_semantics Other recordFields)]
        pub unsafe fn recordFields(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

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

        #[cfg(feature = "CKDatabase")]
        #[method(databaseScope)]
        pub unsafe fn databaseScope(&self) -> CKDatabaseScope;
    }
);

extern_methods!(
    /// Methods declared on superclass `CKNotification`
    unsafe impl CKQueryNotification {
        #[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_id(@__retain_semantics Other notificationFromRemoteNotificationDictionary:)]
        pub unsafe fn notificationFromRemoteNotificationDictionary(
            notification_dictionary: &NSDictionary,
        ) -> Option<Retained<Self>>;
    }
);

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

    unsafe impl ClassType for CKRecordZoneNotification {
        #[inherits(NSObject)]
        type Super = CKNotification;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKRecordZoneNotification {}

unsafe impl Sync for CKRecordZoneNotification {}

unsafe impl NSObjectProtocol for CKRecordZoneNotification {}

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

        #[cfg(feature = "CKDatabase")]
        #[method(databaseScope)]
        pub unsafe fn databaseScope(&self) -> CKDatabaseScope;
    }
);

extern_methods!(
    /// Methods declared on superclass `CKNotification`
    unsafe impl CKRecordZoneNotification {
        #[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_id(@__retain_semantics Other notificationFromRemoteNotificationDictionary:)]
        pub unsafe fn notificationFromRemoteNotificationDictionary(
            notification_dictionary: &NSDictionary,
        ) -> Option<Retained<Self>>;
    }
);

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

    unsafe impl ClassType for CKDatabaseNotification {
        #[inherits(NSObject)]
        type Super = CKNotification;
        type Mutability = InteriorMutable;
    }
);

unsafe impl Send for CKDatabaseNotification {}

unsafe impl Sync for CKDatabaseNotification {}

unsafe impl NSObjectProtocol for CKDatabaseNotification {}

extern_methods!(
    unsafe impl CKDatabaseNotification {
        #[cfg(feature = "CKDatabase")]
        #[method(databaseScope)]
        pub unsafe fn databaseScope(&self) -> CKDatabaseScope;
    }
);

extern_methods!(
    /// Methods declared on superclass `CKNotification`
    unsafe impl CKDatabaseNotification {
        #[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_id(@__retain_semantics Other notificationFromRemoteNotificationDictionary:)]
        pub unsafe fn notificationFromRemoteNotificationDictionary(
            notification_dictionary: &NSDictionary,
        ) -> Option<Retained<Self>>;
    }
);