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
//! 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 CLSContextType(pub NSInteger);
impl CLSContextType {
    #[doc(alias = "CLSContextTypeNone")]
    pub const None: Self = Self(0);
    #[doc(alias = "CLSContextTypeApp")]
    pub const App: Self = Self(1);
    #[doc(alias = "CLSContextTypeChapter")]
    pub const Chapter: Self = Self(2);
    #[doc(alias = "CLSContextTypeSection")]
    pub const Section: Self = Self(3);
    #[doc(alias = "CLSContextTypeLevel")]
    pub const Level: Self = Self(4);
    #[doc(alias = "CLSContextTypePage")]
    pub const Page: Self = Self(5);
    #[doc(alias = "CLSContextTypeTask")]
    pub const Task: Self = Self(6);
    #[doc(alias = "CLSContextTypeChallenge")]
    pub const Challenge: Self = Self(7);
    #[doc(alias = "CLSContextTypeQuiz")]
    pub const Quiz: Self = Self(8);
    #[doc(alias = "CLSContextTypeExercise")]
    pub const Exercise: Self = Self(9);
    #[doc(alias = "CLSContextTypeLesson")]
    pub const Lesson: Self = Self(10);
    #[doc(alias = "CLSContextTypeBook")]
    pub const Book: Self = Self(11);
    #[doc(alias = "CLSContextTypeGame")]
    pub const Game: Self = Self(12);
    #[doc(alias = "CLSContextTypeDocument")]
    pub const Document: Self = Self(13);
    #[doc(alias = "CLSContextTypeAudio")]
    pub const Audio: Self = Self(14);
    #[doc(alias = "CLSContextTypeVideo")]
    pub const Video: Self = Self(15);
    #[doc(alias = "CLSContextTypeCourse")]
    pub const Course: Self = Self(16);
    #[doc(alias = "CLSContextTypeCustom")]
    pub const Custom: Self = Self(17);
}

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

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

// NS_TYPED_ENUM
pub type CLSContextTopic = NSString;

extern "C" {
    pub static CLSContextTopicMath: &'static CLSContextTopic;
}

extern "C" {
    pub static CLSContextTopicScience: &'static CLSContextTopic;
}

extern "C" {
    pub static CLSContextTopicLiteracyAndWriting: &'static CLSContextTopic;
}

extern "C" {
    pub static CLSContextTopicWorldLanguage: &'static CLSContextTopic;
}

extern "C" {
    pub static CLSContextTopicSocialScience: &'static CLSContextTopic;
}

extern "C" {
    pub static CLSContextTopicComputerScienceAndEngineering: &'static CLSContextTopic;
}

extern "C" {
    pub static CLSContextTopicArtsAndMusic: &'static CLSContextTopic;
}

extern "C" {
    pub static CLSContextTopicHealthAndFitness: &'static CLSContextTopic;
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "CLSObject")]
    pub struct CLSContext;

    #[cfg(feature = "CLSObject")]
    unsafe impl ClassType for CLSContext {
        #[inherits(NSObject)]
        type Super = CLSObject;
        type Mutability = InteriorMutable;
    }
);

#[cfg(feature = "CLSObject")]
unsafe impl NSCoding for CLSContext {}

#[cfg(feature = "CLSObject")]
unsafe impl NSObjectProtocol for CLSContext {}

#[cfg(feature = "CLSObject")]
unsafe impl NSSecureCoding for CLSContext {}

extern_methods!(
    #[cfg(feature = "CLSObject")]
    unsafe impl CLSContext {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;

        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

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

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

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

        #[method(setUniversalLinkURL:)]
        pub unsafe fn setUniversalLinkURL(&self, universal_link_url: Option<&NSURL>);

        #[method(type)]
        pub unsafe fn r#type(&self) -> CLSContextType;

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

        #[method(setCustomTypeName:)]
        pub unsafe fn setCustomTypeName(&self, custom_type_name: Option<&NSString>);

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

        #[method(setTitle:)]
        pub unsafe fn setTitle(&self, title: &NSString);

        #[method(displayOrder)]
        pub unsafe fn displayOrder(&self) -> NSInteger;

        #[method(setDisplayOrder:)]
        pub unsafe fn setDisplayOrder(&self, display_order: NSInteger);

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

        #[method(setTopic:)]
        pub unsafe fn setTopic(&self, topic: Option<&CLSContextTopic>);

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

        #[method(setAssignable:)]
        pub unsafe fn setAssignable(&self, assignable: bool);

        #[method(suggestedAge)]
        pub unsafe fn suggestedAge(&self) -> NSRange;

        #[method(setSuggestedAge:)]
        pub unsafe fn setSuggestedAge(&self, suggested_age: NSRange);

        #[method(suggestedCompletionTime)]
        pub unsafe fn suggestedCompletionTime(&self) -> NSRange;

        #[method(setSuggestedCompletionTime:)]
        pub unsafe fn setSuggestedCompletionTime(&self, suggested_completion_time: NSRange);

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

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

        #[method(setSummary:)]
        pub unsafe fn setSummary(&self, summary: Option<&NSString>);

        #[method_id(@__retain_semantics Init initWithType:identifier:title:)]
        pub unsafe fn initWithType_identifier_title(
            this: Allocated<Self>,
            r#type: CLSContextType,
            identifier: &NSString,
            title: &NSString,
        ) -> Retained<Self>;

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

        #[method(becomeActive)]
        pub unsafe fn becomeActive(&self);

        #[method(resignActive)]
        pub unsafe fn resignActive(&self);

        #[method(setType:)]
        pub unsafe fn setType(&self, r#type: CLSContextType);

        #[cfg(feature = "CLSProgressReportingCapability")]
        #[method(addProgressReportingCapabilities:)]
        pub unsafe fn addProgressReportingCapabilities(
            &self,
            capabilities: &NSSet<CLSProgressReportingCapability>,
        );

        #[method(resetProgressReportingCapabilities)]
        pub unsafe fn resetProgressReportingCapabilities(&self);
    }
);

extern_methods!(
    /// Hierarchy
    #[cfg(feature = "CLSObject")]
    unsafe impl CLSContext {
        #[method_id(@__retain_semantics Other parent)]
        pub unsafe fn parent(&self) -> Option<Retained<CLSContext>>;

        #[method(removeFromParent)]
        pub unsafe fn removeFromParent(&self);

        #[method(addChildContext:)]
        pub unsafe fn addChildContext(&self, child: &CLSContext);

        #[cfg(feature = "block2")]
        #[method(descendantMatchingIdentifierPath:completion:)]
        pub unsafe fn descendantMatchingIdentifierPath_completion(
            &self,
            identifier_path: &NSArray<NSString>,
            completion: &block2::Block<dyn Fn(*mut CLSContext, *mut NSError)>,
        );

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

        #[method(addNavigationChildContext:)]
        pub unsafe fn addNavigationChildContext(&self, child: &CLSContext);

        #[method(removeNavigationChildContext:)]
        pub unsafe fn removeNavigationChildContext(&self, child: &CLSContext);
    }
);