objc2_health_kit/generated/
HKStateOfMind.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// A general region of pleasantness derived from valence logged on a state of mind sample.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmindvalenceclassification?language=objc)
13// NS_ENUM
14#[repr(transparent)]
15#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
16pub struct HKStateOfMindValenceClassification(pub NSInteger);
17impl HKStateOfMindValenceClassification {
18    #[doc(alias = "HKStateOfMindValenceClassificationVeryUnpleasant")]
19    pub const VeryUnpleasant: Self = Self(1);
20    #[doc(alias = "HKStateOfMindValenceClassificationUnpleasant")]
21    pub const Unpleasant: Self = Self(2);
22    #[doc(alias = "HKStateOfMindValenceClassificationSlightlyUnpleasant")]
23    pub const SlightlyUnpleasant: Self = Self(3);
24    #[doc(alias = "HKStateOfMindValenceClassificationNeutral")]
25    pub const Neutral: Self = Self(4);
26    #[doc(alias = "HKStateOfMindValenceClassificationSlightlyPleasant")]
27    pub const SlightlyPleasant: Self = Self(5);
28    #[doc(alias = "HKStateOfMindValenceClassificationPleasant")]
29    pub const Pleasant: Self = Self(6);
30    #[doc(alias = "HKStateOfMindValenceClassificationVeryPleasant")]
31    pub const VeryPleasant: Self = Self(7);
32}
33
34unsafe impl Encode for HKStateOfMindValenceClassification {
35    const ENCODING: Encoding = NSInteger::ENCODING;
36}
37
38unsafe impl RefEncode for HKStateOfMindValenceClassification {
39    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
40}
41
42impl HKStateOfMindValenceClassification {
43    /// Returns the valence classification appropriate for a valence value.
44    /// If the given valence is outside the supported range of values, this function returns
45    /// `nil.`
46    #[doc(alias = "HKStateOfMindValenceClassificationForValence")]
47    #[inline]
48    pub unsafe fn for_valence(valence: c_double) -> Option<Retained<NSNumber>> {
49        extern "C-unwind" {
50            fn HKStateOfMindValenceClassificationForValence(valence: c_double) -> *mut NSNumber;
51        }
52        let ret = unsafe { HKStateOfMindValenceClassificationForValence(valence) };
53        unsafe { Retained::retain_autoreleased(ret) }
54    }
55}
56
57/// A specific word describing a felt experience.
58///
59/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmindlabel?language=objc)
60// NS_ENUM
61#[repr(transparent)]
62#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
63pub struct HKStateOfMindLabel(pub NSInteger);
64impl HKStateOfMindLabel {
65    #[doc(alias = "HKStateOfMindLabelAmazed")]
66    pub const Amazed: Self = Self(1);
67    #[doc(alias = "HKStateOfMindLabelAmused")]
68    pub const Amused: Self = Self(2);
69    #[doc(alias = "HKStateOfMindLabelAngry")]
70    pub const Angry: Self = Self(3);
71    #[doc(alias = "HKStateOfMindLabelAnxious")]
72    pub const Anxious: Self = Self(4);
73    #[doc(alias = "HKStateOfMindLabelAshamed")]
74    pub const Ashamed: Self = Self(5);
75    #[doc(alias = "HKStateOfMindLabelBrave")]
76    pub const Brave: Self = Self(6);
77    #[doc(alias = "HKStateOfMindLabelCalm")]
78    pub const Calm: Self = Self(7);
79    #[doc(alias = "HKStateOfMindLabelContent")]
80    pub const Content: Self = Self(8);
81    #[doc(alias = "HKStateOfMindLabelDisappointed")]
82    pub const Disappointed: Self = Self(9);
83    #[doc(alias = "HKStateOfMindLabelDiscouraged")]
84    pub const Discouraged: Self = Self(10);
85    #[doc(alias = "HKStateOfMindLabelDisgusted")]
86    pub const Disgusted: Self = Self(11);
87    #[doc(alias = "HKStateOfMindLabelEmbarrassed")]
88    pub const Embarrassed: Self = Self(12);
89    #[doc(alias = "HKStateOfMindLabelExcited")]
90    pub const Excited: Self = Self(13);
91    #[doc(alias = "HKStateOfMindLabelFrustrated")]
92    pub const Frustrated: Self = Self(14);
93    #[doc(alias = "HKStateOfMindLabelGrateful")]
94    pub const Grateful: Self = Self(15);
95    #[doc(alias = "HKStateOfMindLabelGuilty")]
96    pub const Guilty: Self = Self(16);
97    #[doc(alias = "HKStateOfMindLabelHappy")]
98    pub const Happy: Self = Self(17);
99    #[doc(alias = "HKStateOfMindLabelHopeless")]
100    pub const Hopeless: Self = Self(18);
101    #[doc(alias = "HKStateOfMindLabelIrritated")]
102    pub const Irritated: Self = Self(19);
103    #[doc(alias = "HKStateOfMindLabelJealous")]
104    pub const Jealous: Self = Self(20);
105    #[doc(alias = "HKStateOfMindLabelJoyful")]
106    pub const Joyful: Self = Self(21);
107    #[doc(alias = "HKStateOfMindLabelLonely")]
108    pub const Lonely: Self = Self(22);
109    #[doc(alias = "HKStateOfMindLabelPassionate")]
110    pub const Passionate: Self = Self(23);
111    #[doc(alias = "HKStateOfMindLabelPeaceful")]
112    pub const Peaceful: Self = Self(24);
113    #[doc(alias = "HKStateOfMindLabelProud")]
114    pub const Proud: Self = Self(25);
115    #[doc(alias = "HKStateOfMindLabelRelieved")]
116    pub const Relieved: Self = Self(26);
117    #[doc(alias = "HKStateOfMindLabelSad")]
118    pub const Sad: Self = Self(27);
119    #[doc(alias = "HKStateOfMindLabelScared")]
120    pub const Scared: Self = Self(28);
121    #[doc(alias = "HKStateOfMindLabelStressed")]
122    pub const Stressed: Self = Self(29);
123    #[doc(alias = "HKStateOfMindLabelSurprised")]
124    pub const Surprised: Self = Self(30);
125    #[doc(alias = "HKStateOfMindLabelWorried")]
126    pub const Worried: Self = Self(31);
127    #[doc(alias = "HKStateOfMindLabelAnnoyed")]
128    pub const Annoyed: Self = Self(32);
129    #[doc(alias = "HKStateOfMindLabelConfident")]
130    pub const Confident: Self = Self(33);
131    #[doc(alias = "HKStateOfMindLabelDrained")]
132    pub const Drained: Self = Self(34);
133    #[doc(alias = "HKStateOfMindLabelHopeful")]
134    pub const Hopeful: Self = Self(35);
135    #[doc(alias = "HKStateOfMindLabelIndifferent")]
136    pub const Indifferent: Self = Self(36);
137    #[doc(alias = "HKStateOfMindLabelOverwhelmed")]
138    pub const Overwhelmed: Self = Self(37);
139    #[doc(alias = "HKStateOfMindLabelSatisfied")]
140    pub const Satisfied: Self = Self(38);
141}
142
143unsafe impl Encode for HKStateOfMindLabel {
144    const ENCODING: Encoding = NSInteger::ENCODING;
145}
146
147unsafe impl RefEncode for HKStateOfMindLabel {
148    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
149}
150
151/// A general facet of life with which a felt experience may be associated.
152///
153/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmindassociation?language=objc)
154// NS_ENUM
155#[repr(transparent)]
156#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
157pub struct HKStateOfMindAssociation(pub NSInteger);
158impl HKStateOfMindAssociation {
159    #[doc(alias = "HKStateOfMindAssociationCommunity")]
160    pub const Community: Self = Self(1);
161    #[doc(alias = "HKStateOfMindAssociationCurrentEvents")]
162    pub const CurrentEvents: Self = Self(2);
163    #[doc(alias = "HKStateOfMindAssociationDating")]
164    pub const Dating: Self = Self(3);
165    #[doc(alias = "HKStateOfMindAssociationEducation")]
166    pub const Education: Self = Self(4);
167    #[doc(alias = "HKStateOfMindAssociationFamily")]
168    pub const Family: Self = Self(5);
169    #[doc(alias = "HKStateOfMindAssociationFitness")]
170    pub const Fitness: Self = Self(6);
171    #[doc(alias = "HKStateOfMindAssociationFriends")]
172    pub const Friends: Self = Self(7);
173    #[doc(alias = "HKStateOfMindAssociationHealth")]
174    pub const Health: Self = Self(8);
175    #[doc(alias = "HKStateOfMindAssociationHobbies")]
176    pub const Hobbies: Self = Self(9);
177    #[doc(alias = "HKStateOfMindAssociationIdentity")]
178    pub const Identity: Self = Self(10);
179    #[doc(alias = "HKStateOfMindAssociationMoney")]
180    pub const Money: Self = Self(11);
181    #[doc(alias = "HKStateOfMindAssociationPartner")]
182    pub const Partner: Self = Self(12);
183    #[doc(alias = "HKStateOfMindAssociationSelfCare")]
184    pub const SelfCare: Self = Self(13);
185    #[doc(alias = "HKStateOfMindAssociationSpirituality")]
186    pub const Spirituality: Self = Self(14);
187    #[doc(alias = "HKStateOfMindAssociationTasks")]
188    pub const Tasks: Self = Self(15);
189    #[doc(alias = "HKStateOfMindAssociationTravel")]
190    pub const Travel: Self = Self(16);
191    #[doc(alias = "HKStateOfMindAssociationWork")]
192    pub const Work: Self = Self(17);
193    #[doc(alias = "HKStateOfMindAssociationWeather")]
194    pub const Weather: Self = Self(18);
195}
196
197unsafe impl Encode for HKStateOfMindAssociation {
198    const ENCODING: Encoding = NSInteger::ENCODING;
199}
200
201unsafe impl RefEncode for HKStateOfMindAssociation {
202    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
203}
204
205/// The kind of feeling type captured by a state of mind log, considering the period of time the reflection concerns.
206///
207/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmindkind?language=objc)
208// NS_ENUM
209#[repr(transparent)]
210#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
211pub struct HKStateOfMindKind(pub NSInteger);
212impl HKStateOfMindKind {
213    #[doc(alias = "HKStateOfMindKindMomentaryEmotion")]
214    pub const MomentaryEmotion: Self = Self(1);
215    #[doc(alias = "HKStateOfMindKindDailyMood")]
216    pub const DailyMood: Self = Self(2);
217}
218
219unsafe impl Encode for HKStateOfMindKind {
220    const ENCODING: Encoding = NSInteger::ENCODING;
221}
222
223unsafe impl RefEncode for HKStateOfMindKind {
224    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
225}
226
227extern_class!(
228    /// Represents how one feels, including descriptors of a feeling and optionally, its source.
229    ///
230    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmind?language=objc)
231    #[unsafe(super(HKSample, HKObject, NSObject))]
232    #[derive(Debug, PartialEq, Eq, Hash)]
233    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
234    pub struct HKStateOfMind;
235);
236
237#[cfg(all(feature = "HKObject", feature = "HKSample"))]
238unsafe impl Send for HKStateOfMind {}
239
240#[cfg(all(feature = "HKObject", feature = "HKSample"))]
241unsafe impl Sync for HKStateOfMind {}
242
243#[cfg(all(feature = "HKObject", feature = "HKSample"))]
244extern_conformance!(
245    unsafe impl NSCoding for HKStateOfMind {}
246);
247
248#[cfg(all(feature = "HKObject", feature = "HKSample"))]
249extern_conformance!(
250    unsafe impl NSCopying for HKStateOfMind {}
251);
252
253#[cfg(all(feature = "HKObject", feature = "HKSample"))]
254unsafe impl CopyingHelper for HKStateOfMind {
255    type Result = Self;
256}
257
258#[cfg(all(feature = "HKObject", feature = "HKSample"))]
259extern_conformance!(
260    unsafe impl NSObjectProtocol for HKStateOfMind {}
261);
262
263#[cfg(all(feature = "HKObject", feature = "HKSample"))]
264extern_conformance!(
265    unsafe impl NSSecureCoding for HKStateOfMind {}
266);
267
268#[cfg(all(feature = "HKObject", feature = "HKSample"))]
269impl HKStateOfMind {
270    extern_methods!(
271        /// A description of the kind of feeling type captured by this state of mind.
272        ///
273        /// Feeling types can be understood by the timeframe considered to create this log, possibly indicated by the context used to create it.
274        /// For example, a `momentary emotion` log might be in response to 'how are you feeling right now?' while a `daily mood` log
275        /// might be in response to 'how have you been feeling today?'.
276        ///
277        /// This property is not atomic.
278        ///
279        /// # Safety
280        ///
281        /// This might not be thread-safe.
282        #[unsafe(method(kind))]
283        #[unsafe(method_family = none)]
284        pub unsafe fn kind(&self) -> HKStateOfMindKind;
285
286        /// A signed, self-reported measure of how positive or negative one is feeling, on a continuous scale from -1 to +1.
287        ///
288        /// This property is not atomic.
289        ///
290        /// # Safety
291        ///
292        /// This might not be thread-safe.
293        #[unsafe(method(valence))]
294        #[unsafe(method_family = none)]
295        pub unsafe fn valence(&self) -> c_double;
296
297        /// A general region of pleasantness based on this sample's valence value.
298        ///
299        /// This property is not atomic.
300        ///
301        /// # Safety
302        ///
303        /// This might not be thread-safe.
304        #[unsafe(method(valenceClassification))]
305        #[unsafe(method_family = none)]
306        pub unsafe fn valenceClassification(&self) -> HKStateOfMindValenceClassification;
307
308        /// Zero or more specific sentiments selected to represent a felt experience.
309        ///
310        /// This property is not atomic.
311        ///
312        /// # Safety
313        ///
314        /// This might not be thread-safe.
315        #[unsafe(method(labels))]
316        #[unsafe(method_family = none)]
317        pub unsafe fn labels(&self) -> Retained<NSArray<NSNumber>>;
318
319        /// Zero or more facets of life with which this felt experience is associated.
320        ///
321        /// This property is not atomic.
322        ///
323        /// # Safety
324        ///
325        /// This might not be thread-safe.
326        #[unsafe(method(associations))]
327        #[unsafe(method_family = none)]
328        pub unsafe fn associations(&self) -> Retained<NSArray<NSNumber>>;
329
330        /// Creates a new log describing an experienced emotion at a moment in time.
331        #[unsafe(method(stateOfMindWithDate:kind:valence:labels:associations:))]
332        #[unsafe(method_family = none)]
333        pub unsafe fn stateOfMindWithDate_kind_valence_labels_associations(
334            date: &NSDate,
335            kind: HKStateOfMindKind,
336            valence: c_double,
337            labels: &NSArray<NSNumber>,
338            associations: &NSArray<NSNumber>,
339        ) -> Retained<Self>;
340
341        /// Creates a new log describing an experienced emotion at a moment in time.
342        ///
343        /// # Safety
344        ///
345        /// `metadata` generic should be of the correct type.
346        #[unsafe(method(stateOfMindWithDate:kind:valence:labels:associations:metadata:))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn stateOfMindWithDate_kind_valence_labels_associations_metadata(
349            date: &NSDate,
350            kind: HKStateOfMindKind,
351            valence: c_double,
352            labels: &NSArray<NSNumber>,
353            associations: &NSArray<NSNumber>,
354            metadata: Option<&NSDictionary<NSString, AnyObject>>,
355        ) -> Retained<Self>;
356
357        #[unsafe(method(init))]
358        #[unsafe(method_family = init)]
359        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
360
361        #[unsafe(method(new))]
362        #[unsafe(method_family = new)]
363        pub unsafe fn new() -> Retained<Self>;
364    );
365}
366
367#[deprecated = "renamed to `HKStateOfMindValenceClassification::for_valence`"]
368#[inline]
369pub unsafe extern "C-unwind" fn HKStateOfMindValenceClassificationForValence(
370    valence: c_double,
371) -> Option<Retained<NSNumber>> {
372    extern "C-unwind" {
373        fn HKStateOfMindValenceClassificationForValence(valence: c_double) -> *mut NSNumber;
374    }
375    let ret = unsafe { HKStateOfMindValenceClassificationForValence(valence) };
376    unsafe { Retained::retain_autoreleased(ret) }
377}