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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-location")]
use objc2_core_location::*;
use objc2_foundation::*;

use crate::*;

pub type CKRecordType = NSString;

pub type CKRecordFieldKey = NSString;

extern "C" {
    pub static CKRecordTypeUserRecord: &'static CKRecordType;
}

extern "C" {
    pub static CKRecordRecordIDKey: &'static CKRecordFieldKey;
}

extern "C" {
    pub static CKRecordCreatorUserRecordIDKey: &'static CKRecordFieldKey;
}

extern "C" {
    pub static CKRecordCreationDateKey: &'static CKRecordFieldKey;
}

extern "C" {
    pub static CKRecordLastModifiedUserRecordIDKey: &'static CKRecordFieldKey;
}

extern "C" {
    pub static CKRecordModificationDateKey: &'static CKRecordFieldKey;
}

extern "C" {
    pub static CKRecordParentKey: &'static CKRecordFieldKey;
}

extern "C" {
    pub static CKRecordShareKey: &'static CKRecordFieldKey;
}

extern_protocol!(
    pub unsafe trait CKRecordValue: NSObjectProtocol {}

    unsafe impl ProtocolType for dyn CKRecordValue {}
);

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

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

unsafe impl NSCoding for CKRecord {}

unsafe impl NSCopying for CKRecord {}

unsafe impl NSObjectProtocol for CKRecord {}

unsafe impl NSSecureCoding for CKRecord {}

extern_methods!(
    unsafe impl CKRecord {
        #[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 Init initWithRecordType:)]
        pub unsafe fn initWithRecordType(
            this: Allocated<Self>,
            record_type: &CKRecordType,
        ) -> Retained<Self>;

        #[cfg(feature = "CKRecordID")]
        #[method_id(@__retain_semantics Init initWithRecordType:recordID:)]
        pub unsafe fn initWithRecordType_recordID(
            this: Allocated<Self>,
            record_type: &CKRecordType,
            record_id: &CKRecordID,
        ) -> Retained<Self>;

        #[cfg(feature = "CKRecordZoneID")]
        #[method_id(@__retain_semantics Init initWithRecordType:zoneID:)]
        pub unsafe fn initWithRecordType_zoneID(
            this: Allocated<Self>,
            record_type: &CKRecordType,
            zone_id: &CKRecordZoneID,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other recordType)]
        pub unsafe fn recordType(&self) -> Retained<CKRecordType>;

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

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

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

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

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

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

        #[method_id(@__retain_semantics Other objectForKey:)]
        pub unsafe fn objectForKey(
            &self,
            key: &CKRecordFieldKey,
        ) -> Option<Retained<ProtocolObject<dyn CKRecordValue>>>;

        #[method(setObject:forKey:)]
        pub unsafe fn setObject_forKey(
            &self,
            object: Option<&ProtocolObject<dyn CKRecordValue>>,
            key: &CKRecordFieldKey,
        );

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

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

        #[method_id(@__retain_semantics Other objectForKeyedSubscript:)]
        pub unsafe fn objectForKeyedSubscript(
            &self,
            key: &CKRecordFieldKey,
        ) -> Option<Retained<ProtocolObject<dyn CKRecordValue>>>;

        #[method(setObject:forKeyedSubscript:)]
        pub unsafe fn setObject_forKeyedSubscript(
            &self,
            object: Option<&ProtocolObject<dyn CKRecordValue>>,
            key: &CKRecordFieldKey,
        );

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

        #[method(encodeSystemFieldsWithCoder:)]
        pub unsafe fn encodeSystemFieldsWithCoder(&self, coder: &NSCoder);

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

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

        #[cfg(feature = "CKReference")]
        #[method(setParent:)]
        pub unsafe fn setParent(&self, parent: Option<&CKReference>);

        #[method(setParentReferenceFromRecord:)]
        pub unsafe fn setParentReferenceFromRecord(&self, parent_record: Option<&CKRecord>);

        #[cfg(feature = "CKRecordID")]
        #[method(setParentReferenceFromRecordID:)]
        pub unsafe fn setParentReferenceFromRecordID(&self, parent_record_id: Option<&CKRecordID>);
    }
);

unsafe impl CKRecordValue for NSString {}

unsafe impl CKRecordValue for NSNumber {}

unsafe impl CKRecordValue for NSArray {}

unsafe impl CKRecordValue for NSDate {}

unsafe impl CKRecordValue for NSData {}

extern_methods!(
    /// CKRecordValue
    #[cfg(feature = "CKReference")]
    unsafe impl CKReference {}
);

#[cfg(feature = "CKReference")]
unsafe impl CKRecordValue for CKReference {}

extern_methods!(
    /// CKRecordValue
    #[cfg(feature = "CKAsset")]
    unsafe impl CKAsset {}
);

#[cfg(feature = "CKAsset")]
unsafe impl CKRecordValue for CKAsset {}

#[cfg(feature = "objc2-core-location")]
unsafe impl CKRecordValue for CLLocation {}

extern_protocol!(
    pub unsafe trait CKRecordKeyValueSetting: NSObjectProtocol {
        #[method_id(@__retain_semantics Other objectForKey:)]
        unsafe fn objectForKey(
            &self,
            key: &CKRecordFieldKey,
        ) -> Option<Retained<ProtocolObject<dyn CKRecordValue>>>;

        #[method(setObject:forKey:)]
        unsafe fn setObject_forKey(
            &self,
            object: Option<&ProtocolObject<dyn CKRecordValue>>,
            key: &CKRecordFieldKey,
        );

        #[method_id(@__retain_semantics Other objectForKeyedSubscript:)]
        unsafe fn objectForKeyedSubscript(
            &self,
            key: &CKRecordFieldKey,
        ) -> Option<Retained<ProtocolObject<dyn CKRecordValue>>>;

        #[method(setObject:forKeyedSubscript:)]
        unsafe fn setObject_forKeyedSubscript(
            &self,
            object: Option<&ProtocolObject<dyn CKRecordValue>>,
            key: &CKRecordFieldKey,
        );

        #[method_id(@__retain_semantics Other allKeys)]
        unsafe fn allKeys(&self) -> Retained<NSArray<CKRecordFieldKey>>;

        #[method_id(@__retain_semantics Other changedKeys)]
        unsafe fn changedKeys(&self) -> Retained<NSArray<CKRecordFieldKey>>;
    }

    unsafe impl ProtocolType for dyn CKRecordKeyValueSetting {}
);

extern_methods!(
    /// CKRecordKeyValueSettingConformance
    unsafe impl CKRecord {
        #[method_id(@__retain_semantics Other encryptedValues)]
        pub unsafe fn encryptedValues(
            &self,
        ) -> Retained<ProtocolObject<dyn CKRecordKeyValueSetting>>;
    }
);

unsafe impl CKRecordKeyValueSetting for CKRecord {}