objc2_health_kit/generated/
HKMedicationDoseEvent.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/// The possible statuses of a logged HKMedicationDoseEvent
10///
11/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkmedicationdoseeventlogstatus?language=objc)
12// NS_ENUM
13#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct HKMedicationDoseEventLogStatus(pub NSInteger);
16impl HKMedicationDoseEventLogStatus {
17    #[doc(alias = "HKMedicationDoseEventLogStatusNotInteracted")]
18    pub const NotInteracted: Self = Self(1);
19    #[doc(alias = "HKMedicationDoseEventLogStatusNotificationNotSent")]
20    pub const NotificationNotSent: Self = Self(2);
21    #[doc(alias = "HKMedicationDoseEventLogStatusSnoozed")]
22    pub const Snoozed: Self = Self(3);
23    #[doc(alias = "HKMedicationDoseEventLogStatusTaken")]
24    pub const Taken: Self = Self(4);
25    #[doc(alias = "HKMedicationDoseEventLogStatusSkipped")]
26    pub const Skipped: Self = Self(5);
27    #[doc(alias = "HKMedicationDoseEventLogStatusNotLogged")]
28    pub const NotLogged: Self = Self(6);
29}
30
31unsafe impl Encode for HKMedicationDoseEventLogStatus {
32    const ENCODING: Encoding = NSInteger::ENCODING;
33}
34
35unsafe impl RefEncode for HKMedicationDoseEventLogStatus {
36    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39/// The kind of schedule used to log this dose event.
40///
41/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkmedicationdoseeventscheduletype?language=objc)
42// NS_ENUM
43#[repr(transparent)]
44#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
45pub struct HKMedicationDoseEventScheduleType(pub NSInteger);
46impl HKMedicationDoseEventScheduleType {
47    #[doc(alias = "HKMedicationDoseEventScheduleTypeAsNeeded")]
48    pub const AsNeeded: Self = Self(1);
49    #[doc(alias = "HKMedicationDoseEventScheduleTypeSchedule")]
50    pub const Schedule: Self = Self(2);
51}
52
53unsafe impl Encode for HKMedicationDoseEventScheduleType {
54    const ENCODING: Encoding = NSInteger::ENCODING;
55}
56
57unsafe impl RefEncode for HKMedicationDoseEventScheduleType {
58    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61extern_class!(
62    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkmedicationdoseevent?language=objc)
63    #[unsafe(super(HKSample, HKObject, NSObject))]
64    #[derive(Debug, PartialEq, Eq, Hash)]
65    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
66    pub struct HKMedicationDoseEvent;
67);
68
69#[cfg(all(feature = "HKObject", feature = "HKSample"))]
70unsafe impl Send for HKMedicationDoseEvent {}
71
72#[cfg(all(feature = "HKObject", feature = "HKSample"))]
73unsafe impl Sync for HKMedicationDoseEvent {}
74
75#[cfg(all(feature = "HKObject", feature = "HKSample"))]
76extern_conformance!(
77    unsafe impl NSCoding for HKMedicationDoseEvent {}
78);
79
80#[cfg(all(feature = "HKObject", feature = "HKSample"))]
81extern_conformance!(
82    unsafe impl NSCopying for HKMedicationDoseEvent {}
83);
84
85#[cfg(all(feature = "HKObject", feature = "HKSample"))]
86unsafe impl CopyingHelper for HKMedicationDoseEvent {
87    type Result = Self;
88}
89
90#[cfg(all(feature = "HKObject", feature = "HKSample"))]
91extern_conformance!(
92    unsafe impl NSObjectProtocol for HKMedicationDoseEvent {}
93);
94
95#[cfg(all(feature = "HKObject", feature = "HKSample"))]
96extern_conformance!(
97    unsafe impl NSSecureCoding for HKMedicationDoseEvent {}
98);
99
100#[cfg(all(feature = "HKObject", feature = "HKSample"))]
101impl HKMedicationDoseEvent {
102    extern_methods!(
103        #[cfg(feature = "HKObjectType")]
104        /// The data type of the HKMedicationDoseEvent object.
105        #[unsafe(method(medicationDoseEventType))]
106        #[unsafe(method_family = none)]
107        pub unsafe fn medicationDoseEventType(&self) -> Retained<HKMedicationDoseEventType>;
108
109        /// The impetus behind the dose event.
110        ///
111        /// HKMedicationDoseEventScheduleTypeAsNeeded for doses logged as needed, and HKMedicationDoseEventScheduleTypeSchedule for doses logged from a scheduled event.
112        ///
113        /// This property is not atomic.
114        ///
115        /// # Safety
116        ///
117        /// This might not be thread-safe.
118        #[unsafe(method(scheduleType))]
119        #[unsafe(method_family = none)]
120        pub unsafe fn scheduleType(&self) -> HKMedicationDoseEventScheduleType;
121
122        #[cfg(feature = "HKHealthConceptIdentifier")]
123        /// A unique identifier of the medication concept for which the dose event was created for, used to relate the dose event to the backing HKMedicationConcept object.
124        ///
125        /// This property is not atomic.
126        ///
127        /// # Safety
128        ///
129        /// This might not be thread-safe.
130        #[unsafe(method(medicationConceptIdentifier))]
131        #[unsafe(method_family = none)]
132        pub unsafe fn medicationConceptIdentifier(&self) -> Retained<HKHealthConceptIdentifier>;
133
134        /// The time that the medication dose was supposed to be taken.
135        ///
136        /// Always non-null for scheduled medication dose events, always null for as needed dose events.
137        ///
138        /// This property is not atomic.
139        ///
140        /// # Safety
141        ///
142        /// This might not be thread-safe.
143        #[unsafe(method(scheduledDate))]
144        #[unsafe(method_family = none)]
145        pub unsafe fn scheduledDate(&self) -> Option<Retained<NSDate>>;
146
147        /// The dose quantity a user is expected to take per the user's schedule.
148        ///
149        /// Always non-null for scheduled medication dose events, always null for as needed dose events.
150        ///
151        /// This property is not atomic.
152        ///
153        /// # Safety
154        ///
155        /// This might not be thread-safe.
156        #[unsafe(method(scheduledDoseQuantity))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn scheduledDoseQuantity(&self) -> Option<Retained<NSNumber>>;
159
160        /// The dose quantity the user indicates has actually been taken.
161        ///
162        /// For scheduled dose events, defaults to the scheduledDoseQuantity, when logged from a reminder. For as needed dose events, defaults to 1 in the medication tracking experience, but can be edited by the user at any time.
163        ///
164        /// This property is not atomic.
165        ///
166        /// # Safety
167        ///
168        /// This might not be thread-safe.
169        #[unsafe(method(doseQuantity))]
170        #[unsafe(method_family = none)]
171        pub unsafe fn doseQuantity(&self) -> Option<Retained<NSNumber>>;
172
173        /// The log status of HKMedicationDoseEvent sample.
174        ///
175        /// This property is not atomic.
176        ///
177        /// # Safety
178        ///
179        /// This might not be thread-safe.
180        #[unsafe(method(logStatus))]
181        #[unsafe(method_family = none)]
182        pub unsafe fn logStatus(&self) -> HKMedicationDoseEventLogStatus;
183
184        #[cfg(feature = "HKUnit")]
185        /// The unit that the associated medication had associated at time the user logged the dose event.
186        ///
187        /// This property is not atomic.
188        ///
189        /// # Safety
190        ///
191        /// This might not be thread-safe.
192        #[unsafe(method(unit))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn unit(&self) -> Retained<HKUnit>;
195
196        #[unsafe(method(init))]
197        #[unsafe(method_family = init)]
198        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
199
200        #[unsafe(method(new))]
201        #[unsafe(method_family = new)]
202        pub unsafe fn new() -> Retained<Self>;
203    );
204}
205
206extern "C" {
207    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathstatus?language=objc)
208    pub static HKPredicateKeyPathStatus: &'static NSString;
209}
210
211extern "C" {
212    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathlogorigin?language=objc)
213    pub static HKPredicateKeyPathLogOrigin: &'static NSString;
214}
215
216extern "C" {
217    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathscheduleddate?language=objc)
218    pub static HKPredicateKeyPathScheduledDate: &'static NSString;
219}
220
221extern "C" {
222    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathmedicationconceptidentifier?language=objc)
223    pub static HKPredicateKeyPathMedicationConceptIdentifier: &'static NSString;
224}