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

use crate::*;

// NS_TYPED_EXTENSIBLE_ENUM
pub type NSFileProviderItemIdentifier = NSString;

extern "C" {
    pub static NSFileProviderRootContainerItemIdentifier: &'static NSFileProviderItemIdentifier;
}

extern "C" {
    pub static NSFileProviderWorkingSetContainerItemIdentifier:
        &'static NSFileProviderItemIdentifier;
}

extern "C" {
    pub static NSFileProviderTrashContainerItemIdentifier: &'static NSFileProviderItemIdentifier;
}

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

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

unsafe impl NSObjectProtocol for NSFileProviderItemVersion {}

extern_methods!(
    unsafe impl NSFileProviderItemVersion {
        #[method_id(@__retain_semantics Other beforeFirstSyncComponent)]
        pub unsafe fn beforeFirstSyncComponent() -> Id<NSData>;

        #[method_id(@__retain_semantics Init initWithContentVersion:metadataVersion:)]
        pub unsafe fn initWithContentVersion_metadataVersion(
            this: Allocated<Self>,
            content_version: &NSData,
            metadata_version: &NSData,
        ) -> Id<Self>;

        #[method_id(@__retain_semantics Other contentVersion)]
        pub unsafe fn contentVersion(&self) -> Id<NSData>;

        #[method_id(@__retain_semantics Other metadataVersion)]
        pub unsafe fn metadataVersion(&self) -> Id<NSData>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSFileProviderItemVersion {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Id<Self>;
    }
);

extern "C" {
    pub static NSFileProviderFavoriteRankUnranked: c_ulonglong;
}

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileProviderItemCapabilities(pub NSUInteger);
impl NSFileProviderItemCapabilities {
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsReading")]
    pub const AllowsReading: Self = Self(1 << 0);
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsWriting")]
    pub const AllowsWriting: Self = Self(1 << 1);
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsReparenting")]
    pub const AllowsReparenting: Self = Self(1 << 2);
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsRenaming")]
    pub const AllowsRenaming: Self = Self(1 << 3);
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsTrashing")]
    pub const AllowsTrashing: Self = Self(1 << 4);
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsDeleting")]
    pub const AllowsDeleting: Self = Self(1 << 5);
    #[deprecated = "use NSFileProviderContentPolicy instead"]
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsEvicting")]
    pub const AllowsEvicting: Self = Self(1 << 6);
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsExcludingFromSync")]
    pub const AllowsExcludingFromSync: Self = Self(1 << 7);
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsAddingSubItems")]
    pub const AllowsAddingSubItems: Self = Self(NSFileProviderItemCapabilities::AllowsWriting.0);
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsContentEnumerating")]
    pub const AllowsContentEnumerating: Self =
        Self(NSFileProviderItemCapabilities::AllowsReading.0);
    #[deprecated = "This capability is no longer supported, and does not contain all capabilities. Please migrate to directly specifying each of the individual capabilities that should be allowed for the item."]
    #[doc(alias = "NSFileProviderItemCapabilitiesAllowsAll")]
    pub const AllowsAll: Self = Self(
        NSFileProviderItemCapabilities::AllowsReading.0
            | NSFileProviderItemCapabilities::AllowsWriting.0
            | NSFileProviderItemCapabilities::AllowsReparenting.0
            | NSFileProviderItemCapabilities::AllowsRenaming.0
            | NSFileProviderItemCapabilities::AllowsTrashing.0
            | NSFileProviderItemCapabilities::AllowsDeleting.0,
    );
}

unsafe impl Encode for NSFileProviderItemCapabilities {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileProviderItemFields(pub NSUInteger);
impl NSFileProviderItemFields {
    pub const NSFileProviderItemContents: Self = Self(1 << 0);
    pub const NSFileProviderItemFilename: Self = Self(1 << 1);
    pub const NSFileProviderItemParentItemIdentifier: Self = Self(1 << 2);
    pub const NSFileProviderItemLastUsedDate: Self = Self(1 << 3);
    pub const NSFileProviderItemTagData: Self = Self(1 << 4);
    pub const NSFileProviderItemFavoriteRank: Self = Self(1 << 5);
    pub const NSFileProviderItemCreationDate: Self = Self(1 << 6);
    pub const NSFileProviderItemContentModificationDate: Self = Self(1 << 7);
    pub const NSFileProviderItemFileSystemFlags: Self = Self(1 << 8);
    pub const NSFileProviderItemExtendedAttributes: Self = Self(1 << 9);
    pub const NSFileProviderItemTypeAndCreator: Self = Self(1 << 10);
}

unsafe impl Encode for NSFileProviderItemFields {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileProviderFileSystemFlags(pub NSUInteger);
impl NSFileProviderFileSystemFlags {
    pub const NSFileProviderFileSystemUserExecutable: Self = Self(1 << 0);
    pub const NSFileProviderFileSystemUserReadable: Self = Self(1 << 1);
    pub const NSFileProviderFileSystemUserWritable: Self = Self(1 << 2);
    pub const NSFileProviderFileSystemHidden: Self = Self(1 << 3);
    pub const NSFileProviderFileSystemPathExtensionHidden: Self = Self(1 << 4);
}

unsafe impl Encode for NSFileProviderFileSystemFlags {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

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

#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NSFileProviderTypeAndCreator {
    pub r#type: OSType,
    pub creator: OSType,
}

unsafe impl Encode for NSFileProviderTypeAndCreator {
    const ENCODING: Encoding = Encoding::Struct(
        "NSFileProviderTypeAndCreator",
        &[<OSType>::ENCODING, <OSType>::ENCODING],
    );
}

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

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFileProviderContentPolicy(pub NSInteger);
impl NSFileProviderContentPolicy {
    #[doc(alias = "NSFileProviderContentPolicyInherited")]
    pub const Inherited: Self = Self(0);
    #[doc(alias = "NSFileProviderContentPolicyDownloadLazily")]
    pub const DownloadLazily: Self = Self(1);
    #[doc(alias = "NSFileProviderContentPolicyDownloadLazilyAndEvictOnRemoteUpdate")]
    pub const DownloadLazilyAndEvictOnRemoteUpdate: Self = Self(2);
    #[doc(alias = "NSFileProviderContentPolicyDownloadEagerlyAndKeepDownloaded")]
    pub const DownloadEagerlyAndKeepDownloaded: Self = Self(3);
}

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

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

extern_protocol!(
    pub unsafe trait NSFileProviderItemProtocol: NSObjectProtocol {
        #[method_id(@__retain_semantics Other itemIdentifier)]
        unsafe fn itemIdentifier(&self) -> Id<NSFileProviderItemIdentifier>;

        #[method_id(@__retain_semantics Other parentItemIdentifier)]
        unsafe fn parentItemIdentifier(&self) -> Id<NSFileProviderItemIdentifier>;

        #[method_id(@__retain_semantics Other filename)]
        unsafe fn filename(&self) -> Id<NSString>;

        #[cfg(feature = "objc2-uniform-type-identifiers")]
        #[optional]
        #[method_id(@__retain_semantics Other contentType)]
        unsafe fn contentType(&self) -> Id<UTType>;

        #[deprecated]
        #[optional]
        #[method_id(@__retain_semantics Other typeIdentifier)]
        unsafe fn typeIdentifier(&self) -> Id<NSString>;

        #[optional]
        #[method(typeAndCreator)]
        unsafe fn typeAndCreator(&self) -> NSFileProviderTypeAndCreator;

        #[optional]
        #[method(capabilities)]
        unsafe fn capabilities(&self) -> NSFileProviderItemCapabilities;

        #[optional]
        #[method(fileSystemFlags)]
        unsafe fn fileSystemFlags(&self) -> NSFileProviderFileSystemFlags;

        #[optional]
        #[method_id(@__retain_semantics Other documentSize)]
        unsafe fn documentSize(&self) -> Option<Id<NSNumber>>;

        #[optional]
        #[method_id(@__retain_semantics Other childItemCount)]
        unsafe fn childItemCount(&self) -> Option<Id<NSNumber>>;

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

        #[optional]
        #[method_id(@__retain_semantics Other contentModificationDate)]
        unsafe fn contentModificationDate(&self) -> Option<Id<NSDate>>;

        #[optional]
        #[method_id(@__retain_semantics Other extendedAttributes)]
        unsafe fn extendedAttributes(&self) -> Id<NSDictionary<NSString, NSData>>;

        #[optional]
        #[method_id(@__retain_semantics Other lastUsedDate)]
        unsafe fn lastUsedDate(&self) -> Option<Id<NSDate>>;

        #[optional]
        #[method_id(@__retain_semantics Other tagData)]
        unsafe fn tagData(&self) -> Option<Id<NSData>>;

        #[optional]
        #[method_id(@__retain_semantics Other favoriteRank)]
        unsafe fn favoriteRank(&self) -> Option<Id<NSNumber>>;

        #[optional]
        #[method(isTrashed)]
        unsafe fn isTrashed(&self) -> bool;

        #[optional]
        #[method(isUploaded)]
        unsafe fn isUploaded(&self) -> bool;

        #[optional]
        #[method(isUploading)]
        unsafe fn isUploading(&self) -> bool;

        #[optional]
        #[method_id(@__retain_semantics Other uploadingError)]
        unsafe fn uploadingError(&self) -> Option<Id<NSError>>;

        #[optional]
        #[method(isDownloaded)]
        unsafe fn isDownloaded(&self) -> bool;

        #[optional]
        #[method(isDownloading)]
        unsafe fn isDownloading(&self) -> bool;

        #[optional]
        #[method_id(@__retain_semantics Other downloadingError)]
        unsafe fn downloadingError(&self) -> Option<Id<NSError>>;

        #[optional]
        #[method(isMostRecentVersionDownloaded)]
        unsafe fn isMostRecentVersionDownloaded(&self) -> bool;

        #[optional]
        #[method(isShared)]
        unsafe fn isShared(&self) -> bool;

        #[optional]
        #[method(isSharedByCurrentUser)]
        unsafe fn isSharedByCurrentUser(&self) -> bool;

        #[optional]
        #[method_id(@__retain_semantics Other ownerNameComponents)]
        unsafe fn ownerNameComponents(&self) -> Option<Id<NSPersonNameComponents>>;

        #[optional]
        #[method_id(@__retain_semantics Other mostRecentEditorNameComponents)]
        unsafe fn mostRecentEditorNameComponents(&self) -> Option<Id<NSPersonNameComponents>>;

        #[optional]
        #[method_id(@__retain_semantics Other versionIdentifier)]
        unsafe fn versionIdentifier(&self) -> Option<Id<NSData>>;

        #[optional]
        #[method_id(@__retain_semantics Other itemVersion)]
        unsafe fn itemVersion(&self) -> Id<NSFileProviderItemVersion>;

        #[optional]
        #[method_id(@__retain_semantics Other symlinkTargetPath)]
        unsafe fn symlinkTargetPath(&self) -> Option<Id<NSString>>;

        #[optional]
        #[method_id(@__retain_semantics Other userInfo)]
        unsafe fn userInfo(&self) -> Option<Id<NSDictionary>>;

        #[optional]
        #[method(contentPolicy)]
        unsafe fn contentPolicy(&self) -> NSFileProviderContentPolicy;
    }

    unsafe impl ProtocolType for dyn NSFileProviderItemProtocol {
        const NAME: &'static str = "NSFileProviderItem";
    }
);

pub type NSFileProviderItem = ProtocolObject<dyn NSFileProviderItemProtocol>;