objc2_health_kit/generated/
HKGAD7Assessment.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9/// Anxiety risk level determined by GAD-7 assessment.
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkgad7assessmentrisk?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct HKGAD7AssessmentRisk(pub NSInteger);
16impl HKGAD7AssessmentRisk {
17    #[doc(alias = "HKGAD7AssessmentRiskNoneToMinimal")]
18    pub const NoneToMinimal: Self = Self(1);
19    #[doc(alias = "HKGAD7AssessmentRiskMild")]
20    pub const Mild: Self = Self(2);
21    #[doc(alias = "HKGAD7AssessmentRiskModerate")]
22    pub const Moderate: Self = Self(3);
23    #[doc(alias = "HKGAD7AssessmentRiskSevere")]
24    pub const Severe: Self = Self(4);
25}
26
27unsafe impl Encode for HKGAD7AssessmentRisk {
28    const ENCODING: Encoding = NSInteger::ENCODING;
29}
30
31unsafe impl RefEncode for HKGAD7AssessmentRisk {
32    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35/// Answer to question on GAD-7 assessment.
36///
37/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkgad7assessmentanswer?language=objc)
38// NS_ENUM
39#[repr(transparent)]
40#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
41pub struct HKGAD7AssessmentAnswer(pub NSInteger);
42impl HKGAD7AssessmentAnswer {
43    #[doc(alias = "HKGAD7AssessmentAnswerNotAtAll")]
44    pub const NotAtAll: Self = Self(0);
45    #[doc(alias = "HKGAD7AssessmentAnswerSeveralDays")]
46    pub const SeveralDays: Self = Self(1);
47    #[doc(alias = "HKGAD7AssessmentAnswerMoreThanHalfTheDays")]
48    pub const MoreThanHalfTheDays: Self = Self(2);
49    #[doc(alias = "HKGAD7AssessmentAnswerNearlyEveryDay")]
50    pub const NearlyEveryDay: Self = Self(3);
51}
52
53unsafe impl Encode for HKGAD7AssessmentAnswer {
54    const ENCODING: Encoding = NSInteger::ENCODING;
55}
56
57unsafe impl RefEncode for HKGAD7AssessmentAnswer {
58    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61extern "C-unwind" {
62    /// Returns the lower bound of the score range for the given GAD-7 risk classification.
63    pub fn HKMinimumScoreForGAD7AssessmentRisk(risk: HKGAD7AssessmentRisk) -> NSInteger;
64}
65
66extern "C-unwind" {
67    /// Returns the upper bound of the score range for the given GAD-7 risk classification.
68    pub fn HKMaximumScoreForGAD7AssessmentRisk(risk: HKGAD7AssessmentRisk) -> NSInteger;
69}
70
71extern_class!(
72    /// Represents the result of a GAD-7 assessment. Learn more about Pfizer's GAD-7 at https://support.apple.com/en-us/105070
73    ///
74    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkgad7assessment?language=objc)
75    #[unsafe(super(HKScoredAssessment, HKSample, HKObject, NSObject))]
76    #[derive(Debug, PartialEq, Eq, Hash)]
77    #[cfg(all(
78        feature = "HKObject",
79        feature = "HKSample",
80        feature = "HKScoredAssessment"
81    ))]
82    pub struct HKGAD7Assessment;
83);
84
85#[cfg(all(
86    feature = "HKObject",
87    feature = "HKSample",
88    feature = "HKScoredAssessment"
89))]
90unsafe impl Send for HKGAD7Assessment {}
91
92#[cfg(all(
93    feature = "HKObject",
94    feature = "HKSample",
95    feature = "HKScoredAssessment"
96))]
97unsafe impl Sync for HKGAD7Assessment {}
98
99#[cfg(all(
100    feature = "HKObject",
101    feature = "HKSample",
102    feature = "HKScoredAssessment"
103))]
104extern_conformance!(
105    unsafe impl NSCoding for HKGAD7Assessment {}
106);
107
108#[cfg(all(
109    feature = "HKObject",
110    feature = "HKSample",
111    feature = "HKScoredAssessment"
112))]
113extern_conformance!(
114    unsafe impl NSCopying for HKGAD7Assessment {}
115);
116
117#[cfg(all(
118    feature = "HKObject",
119    feature = "HKSample",
120    feature = "HKScoredAssessment"
121))]
122unsafe impl CopyingHelper for HKGAD7Assessment {
123    type Result = Self;
124}
125
126#[cfg(all(
127    feature = "HKObject",
128    feature = "HKSample",
129    feature = "HKScoredAssessment"
130))]
131extern_conformance!(
132    unsafe impl NSObjectProtocol for HKGAD7Assessment {}
133);
134
135#[cfg(all(
136    feature = "HKObject",
137    feature = "HKSample",
138    feature = "HKScoredAssessment"
139))]
140extern_conformance!(
141    unsafe impl NSSecureCoding for HKGAD7Assessment {}
142);
143
144#[cfg(all(
145    feature = "HKObject",
146    feature = "HKSample",
147    feature = "HKScoredAssessment"
148))]
149impl HKGAD7Assessment {
150    extern_methods!(
151        /// Answers on the GAD-7 assessment. There are exactly 7 answers, one for each multiple choice question. Each answer is of type `HKGAD7AssessmentAnswer`.
152        ///
153        /// This property is not atomic.
154        ///
155        /// # Safety
156        ///
157        /// This might not be thread-safe.
158        #[unsafe(method(answers))]
159        #[unsafe(method_family = none)]
160        pub unsafe fn answers(&self) -> Retained<NSArray<NSNumber>>;
161
162        /// The risk determined by the score on a GAD-7 assessment.
163        ///
164        /// This property is not atomic.
165        ///
166        /// # Safety
167        ///
168        /// This might not be thread-safe.
169        #[unsafe(method(risk))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn risk(&self) -> HKGAD7AssessmentRisk;
172
173        /// Creates a new GAD-7 sample. There must be exactly 7 elements in answers, each answer must be of type `HKGAD7AssessmentAnswer`.
174        #[unsafe(method(assessmentWithDate:answers:))]
175        #[unsafe(method_family = none)]
176        pub unsafe fn assessmentWithDate_answers(
177            date: &NSDate,
178            answers: &NSArray<NSNumber>,
179        ) -> Retained<Self>;
180
181        /// Creates a new GAD-7 sample. There must be exactly 7 elements in answers, each answer must be of type `HKGAD7AssessmentAnswer`.
182        ///
183        /// # Safety
184        ///
185        /// `metadata` generic should be of the correct type.
186        #[unsafe(method(assessmentWithDate:answers:metadata:))]
187        #[unsafe(method_family = none)]
188        pub unsafe fn assessmentWithDate_answers_metadata(
189            date: &NSDate,
190            answers: &NSArray<NSNumber>,
191            metadata: Option<&NSDictionary<NSString, AnyObject>>,
192        ) -> Retained<Self>;
193
194        #[unsafe(method(init))]
195        #[unsafe(method_family = init)]
196        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
197
198        #[unsafe(method(new))]
199        #[unsafe(method_family = new)]
200        pub unsafe fn new() -> Retained<Self>;
201    );
202}