objc2-health-kit 0.3.2

Bindings to the HealthKit framework
Documentation
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
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// Represents a particular type of workout or exercise
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutactivitytype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct HKWorkoutActivityType(pub NSUInteger);
impl HKWorkoutActivityType {
    #[doc(alias = "HKWorkoutActivityTypeAmericanFootball")]
    pub const AmericanFootball: Self = Self(1);
    #[doc(alias = "HKWorkoutActivityTypeArchery")]
    pub const Archery: Self = Self(2);
    #[doc(alias = "HKWorkoutActivityTypeAustralianFootball")]
    pub const AustralianFootball: Self = Self(3);
    #[doc(alias = "HKWorkoutActivityTypeBadminton")]
    pub const Badminton: Self = Self(4);
    #[doc(alias = "HKWorkoutActivityTypeBaseball")]
    pub const Baseball: Self = Self(5);
    #[doc(alias = "HKWorkoutActivityTypeBasketball")]
    pub const Basketball: Self = Self(6);
    #[doc(alias = "HKWorkoutActivityTypeBowling")]
    pub const Bowling: Self = Self(7);
    #[doc(alias = "HKWorkoutActivityTypeBoxing")]
    pub const Boxing: Self = Self(8);
    #[doc(alias = "HKWorkoutActivityTypeClimbing")]
    pub const Climbing: Self = Self(9);
    #[doc(alias = "HKWorkoutActivityTypeCricket")]
    pub const Cricket: Self = Self(10);
    #[doc(alias = "HKWorkoutActivityTypeCrossTraining")]
    pub const CrossTraining: Self = Self(11);
    #[doc(alias = "HKWorkoutActivityTypeCurling")]
    pub const Curling: Self = Self(12);
    #[doc(alias = "HKWorkoutActivityTypeCycling")]
    pub const Cycling: Self = Self(13);
    #[doc(alias = "HKWorkoutActivityTypeDance")]
    #[deprecated = "Use HKWorkoutActivityTypeSocialDance or HKWorkoutActivityTypeCardioDance"]
    pub const Dance: Self = Self(14);
    #[doc(alias = "HKWorkoutActivityTypeDanceInspiredTraining")]
    #[deprecated = "Use HKWorkoutActivityTypeSocialDance, HKWorkoutActivityTypeCardioDance, HKWorkoutActivityTypeBarre or HKWorkoutActivityTypePilates"]
    pub const DanceInspiredTraining: Self = Self(15);
    #[doc(alias = "HKWorkoutActivityTypeElliptical")]
    pub const Elliptical: Self = Self(16);
    #[doc(alias = "HKWorkoutActivityTypeEquestrianSports")]
    pub const EquestrianSports: Self = Self(17);
    #[doc(alias = "HKWorkoutActivityTypeFencing")]
    pub const Fencing: Self = Self(18);
    #[doc(alias = "HKWorkoutActivityTypeFishing")]
    pub const Fishing: Self = Self(19);
    #[doc(alias = "HKWorkoutActivityTypeFunctionalStrengthTraining")]
    pub const FunctionalStrengthTraining: Self = Self(20);
    #[doc(alias = "HKWorkoutActivityTypeGolf")]
    pub const Golf: Self = Self(21);
    #[doc(alias = "HKWorkoutActivityTypeGymnastics")]
    pub const Gymnastics: Self = Self(22);
    #[doc(alias = "HKWorkoutActivityTypeHandball")]
    pub const Handball: Self = Self(23);
    #[doc(alias = "HKWorkoutActivityTypeHiking")]
    pub const Hiking: Self = Self(24);
    #[doc(alias = "HKWorkoutActivityTypeHockey")]
    pub const Hockey: Self = Self(25);
    #[doc(alias = "HKWorkoutActivityTypeHunting")]
    pub const Hunting: Self = Self(26);
    #[doc(alias = "HKWorkoutActivityTypeLacrosse")]
    pub const Lacrosse: Self = Self(27);
    #[doc(alias = "HKWorkoutActivityTypeMartialArts")]
    pub const MartialArts: Self = Self(28);
    #[doc(alias = "HKWorkoutActivityTypeMindAndBody")]
    pub const MindAndBody: Self = Self(29);
    #[doc(alias = "HKWorkoutActivityTypeMixedMetabolicCardioTraining")]
    #[deprecated = "Use HKWorkoutActivityTypeMixedCardio or HKWorkoutActivityTypeHighIntensityIntervalTraining"]
    pub const MixedMetabolicCardioTraining: Self = Self(30);
    #[doc(alias = "HKWorkoutActivityTypePaddleSports")]
    pub const PaddleSports: Self = Self(31);
    #[doc(alias = "HKWorkoutActivityTypePlay")]
    pub const Play: Self = Self(32);
    #[doc(alias = "HKWorkoutActivityTypePreparationAndRecovery")]
    pub const PreparationAndRecovery: Self = Self(33);
    #[doc(alias = "HKWorkoutActivityTypeRacquetball")]
    pub const Racquetball: Self = Self(34);
    #[doc(alias = "HKWorkoutActivityTypeRowing")]
    pub const Rowing: Self = Self(35);
    #[doc(alias = "HKWorkoutActivityTypeRugby")]
    pub const Rugby: Self = Self(36);
    #[doc(alias = "HKWorkoutActivityTypeRunning")]
    pub const Running: Self = Self(37);
    #[doc(alias = "HKWorkoutActivityTypeSailing")]
    pub const Sailing: Self = Self(38);
    #[doc(alias = "HKWorkoutActivityTypeSkatingSports")]
    pub const SkatingSports: Self = Self(39);
    #[doc(alias = "HKWorkoutActivityTypeSnowSports")]
    pub const SnowSports: Self = Self(40);
    #[doc(alias = "HKWorkoutActivityTypeSoccer")]
    pub const Soccer: Self = Self(41);
    #[doc(alias = "HKWorkoutActivityTypeSoftball")]
    pub const Softball: Self = Self(42);
    #[doc(alias = "HKWorkoutActivityTypeSquash")]
    pub const Squash: Self = Self(43);
    #[doc(alias = "HKWorkoutActivityTypeStairClimbing")]
    pub const StairClimbing: Self = Self(44);
    #[doc(alias = "HKWorkoutActivityTypeSurfingSports")]
    pub const SurfingSports: Self = Self(45);
    #[doc(alias = "HKWorkoutActivityTypeSwimming")]
    pub const Swimming: Self = Self(46);
    #[doc(alias = "HKWorkoutActivityTypeTableTennis")]
    pub const TableTennis: Self = Self(47);
    #[doc(alias = "HKWorkoutActivityTypeTennis")]
    pub const Tennis: Self = Self(48);
    #[doc(alias = "HKWorkoutActivityTypeTrackAndField")]
    pub const TrackAndField: Self = Self(49);
    #[doc(alias = "HKWorkoutActivityTypeTraditionalStrengthTraining")]
    pub const TraditionalStrengthTraining: Self = Self(50);
    #[doc(alias = "HKWorkoutActivityTypeVolleyball")]
    pub const Volleyball: Self = Self(51);
    #[doc(alias = "HKWorkoutActivityTypeWalking")]
    pub const Walking: Self = Self(52);
    #[doc(alias = "HKWorkoutActivityTypeWaterFitness")]
    pub const WaterFitness: Self = Self(53);
    #[doc(alias = "HKWorkoutActivityTypeWaterPolo")]
    pub const WaterPolo: Self = Self(54);
    #[doc(alias = "HKWorkoutActivityTypeWaterSports")]
    pub const WaterSports: Self = Self(55);
    #[doc(alias = "HKWorkoutActivityTypeWrestling")]
    pub const Wrestling: Self = Self(56);
    #[doc(alias = "HKWorkoutActivityTypeYoga")]
    pub const Yoga: Self = Self(57);
    #[doc(alias = "HKWorkoutActivityTypeBarre")]
    pub const Barre: Self = Self(58);
    #[doc(alias = "HKWorkoutActivityTypeCoreTraining")]
    pub const CoreTraining: Self = Self(59);
    #[doc(alias = "HKWorkoutActivityTypeCrossCountrySkiing")]
    pub const CrossCountrySkiing: Self = Self(60);
    #[doc(alias = "HKWorkoutActivityTypeDownhillSkiing")]
    pub const DownhillSkiing: Self = Self(61);
    #[doc(alias = "HKWorkoutActivityTypeFlexibility")]
    pub const Flexibility: Self = Self(62);
    #[doc(alias = "HKWorkoutActivityTypeHighIntensityIntervalTraining")]
    pub const HighIntensityIntervalTraining: Self = Self(63);
    #[doc(alias = "HKWorkoutActivityTypeJumpRope")]
    pub const JumpRope: Self = Self(64);
    #[doc(alias = "HKWorkoutActivityTypeKickboxing")]
    pub const Kickboxing: Self = Self(65);
    #[doc(alias = "HKWorkoutActivityTypePilates")]
    pub const Pilates: Self = Self(66);
    #[doc(alias = "HKWorkoutActivityTypeSnowboarding")]
    pub const Snowboarding: Self = Self(67);
    #[doc(alias = "HKWorkoutActivityTypeStairs")]
    pub const Stairs: Self = Self(68);
    #[doc(alias = "HKWorkoutActivityTypeStepTraining")]
    pub const StepTraining: Self = Self(69);
    #[doc(alias = "HKWorkoutActivityTypeWheelchairWalkPace")]
    pub const WheelchairWalkPace: Self = Self(70);
    #[doc(alias = "HKWorkoutActivityTypeWheelchairRunPace")]
    pub const WheelchairRunPace: Self = Self(71);
    #[doc(alias = "HKWorkoutActivityTypeTaiChi")]
    pub const TaiChi: Self = Self(72);
    #[doc(alias = "HKWorkoutActivityTypeMixedCardio")]
    pub const MixedCardio: Self = Self(73);
    #[doc(alias = "HKWorkoutActivityTypeHandCycling")]
    pub const HandCycling: Self = Self(74);
    #[doc(alias = "HKWorkoutActivityTypeDiscSports")]
    pub const DiscSports: Self = Self(75);
    #[doc(alias = "HKWorkoutActivityTypeFitnessGaming")]
    pub const FitnessGaming: Self = Self(76);
    #[doc(alias = "HKWorkoutActivityTypeCardioDance")]
    pub const CardioDance: Self = Self(77);
    #[doc(alias = "HKWorkoutActivityTypeSocialDance")]
    pub const SocialDance: Self = Self(78);
    #[doc(alias = "HKWorkoutActivityTypePickleball")]
    pub const Pickleball: Self = Self(79);
    #[doc(alias = "HKWorkoutActivityTypeCooldown")]
    pub const Cooldown: Self = Self(80);
    #[doc(alias = "HKWorkoutActivityTypeSwimBikeRun")]
    pub const SwimBikeRun: Self = Self(82);
    #[doc(alias = "HKWorkoutActivityTypeTransition")]
    pub const Transition: Self = Self(83);
    #[doc(alias = "HKWorkoutActivityTypeUnderwaterDiving")]
    pub const UnderwaterDiving: Self = Self(84);
    #[doc(alias = "HKWorkoutActivityTypeOther")]
    pub const Other: Self = Self(3000);
}

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

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

/// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkouteventtype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct HKWorkoutEventType(pub NSInteger);
impl HKWorkoutEventType {
    #[doc(alias = "HKWorkoutEventTypePause")]
    pub const Pause: Self = Self(1);
    #[doc(alias = "HKWorkoutEventTypeResume")]
    pub const Resume: Self = Self(2);
    #[doc(alias = "HKWorkoutEventTypeLap")]
    pub const Lap: Self = Self(3);
    #[doc(alias = "HKWorkoutEventTypeMarker")]
    pub const Marker: Self = Self(4);
    #[doc(alias = "HKWorkoutEventTypeMotionPaused")]
    pub const MotionPaused: Self = Self(5);
    #[doc(alias = "HKWorkoutEventTypeMotionResumed")]
    pub const MotionResumed: Self = Self(6);
    #[doc(alias = "HKWorkoutEventTypeSegment")]
    pub const Segment: Self = Self(7);
    #[doc(alias = "HKWorkoutEventTypePauseOrResumeRequest")]
    pub const PauseOrResumeRequest: Self = Self(8);
}

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

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

extern_class!(
    /// Represents a particular event that occurred during a workout.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutevent?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct HKWorkoutEvent;
);

unsafe impl Send for HKWorkoutEvent {}

unsafe impl Sync for HKWorkoutEvent {}

extern_conformance!(
    unsafe impl NSCoding for HKWorkoutEvent {}
);

extern_conformance!(
    unsafe impl NSCopying for HKWorkoutEvent {}
);

unsafe impl CopyingHelper for HKWorkoutEvent {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for HKWorkoutEvent {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for HKWorkoutEvent {}
);

impl HKWorkoutEvent {
    extern_methods!(
        /// Represents the type of event that occurred during a workout.
        #[unsafe(method(type))]
        #[unsafe(method_family = none)]
        pub unsafe fn r#type(&self) -> HKWorkoutEventType;

        #[deprecated]
        #[unsafe(method(date))]
        #[unsafe(method_family = none)]
        pub unsafe fn date(&self) -> Retained<NSDate>;

        /// Date interval representing the time period for which the event is valid.
        ///
        /// Most event types only support date intervals with zero duration. Events of type HKWorkoutEventTypeLap
        /// and HKWorkoutEventTypeSegment are currently the only events that support a nonzero duration.
        #[unsafe(method(dateInterval))]
        #[unsafe(method_family = none)]
        pub unsafe fn dateInterval(&self) -> Retained<NSDateInterval>;

        /// Extra information describing properties of the receiver.
        ///
        /// Keys must be NSString and values must be either NSString, NSNumber, NSDate, or
        /// HKQuantity. See HKMetadata.h for potential metadata keys and values.
        #[unsafe(method(metadata))]
        #[unsafe(method_family = none)]
        pub unsafe fn metadata(&self) -> Option<Retained<NSDictionary<NSString, AnyObject>>>;

        #[deprecated]
        #[unsafe(method(workoutEventWithType:date:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutEventWithType_date(
            r#type: HKWorkoutEventType,
            date: &NSDate,
        ) -> Retained<Self>;

        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[deprecated]
        #[unsafe(method(workoutEventWithType:date:metadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutEventWithType_date_metadata(
            r#type: HKWorkoutEventType,
            date: &NSDate,
            metadata: &NSDictionary<NSString, AnyObject>,
        ) -> Retained<Self>;

        /// Creates an event with a date interval with or without a duration.
        ///
        /// Parameter `type`: The type of event to create
        ///
        /// Parameter `dateInterval`: The dateInterval over which the event occurs
        ///
        /// Parameter `metadata`: Dictionary of metadata associated with the event, nullable
        ///
        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[unsafe(method(workoutEventWithType:dateInterval:metadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutEventWithType_dateInterval_metadata(
            r#type: HKWorkoutEventType,
            date_interval: &NSDateInterval,
            metadata: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
impl HKWorkoutEvent {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// An HKObject subclass representing a workout or activity
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkout?language=objc)
    #[unsafe(super(HKSample, HKObject, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
    pub struct HKWorkout;
);

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
unsafe impl Send for HKWorkout {}

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
unsafe impl Sync for HKWorkout {}

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
extern_conformance!(
    unsafe impl NSCoding for HKWorkout {}
);

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for HKWorkout {}
);

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
extern_conformance!(
    unsafe impl NSSecureCoding for HKWorkout {}
);

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
impl HKWorkout {
    extern_methods!(
        /// Represents the activity that the user was performing during a workout
        #[unsafe(method(workoutActivityType))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutActivityType(&self) -> HKWorkoutActivityType;

        /// An array of HKWorkoutEvents that occurred during a workout.
        ///
        /// These events will be ordered by date in ascending order. All events must take place
        /// between the start date and end date of the workout. The first workout event should never be a resume event
        /// because it is assumed that the workout begins in a running state.
        #[unsafe(method(workoutEvents))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutEvents(&self) -> Option<Retained<NSArray<HKWorkoutEvent>>>;

        #[cfg(feature = "HKWorkoutActivity")]
        /// An array of HKWorkoutActivities that were performed during a workout.
        ///
        /// These activities will be ordered by date in ascending order. All activities must take place
        /// between the start date and end date of the workout.
        #[unsafe(method(workoutActivities))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutActivities(&self) -> Retained<NSArray<HKWorkoutActivity>>;

        /// The length of time that a workout was recording
        ///
        /// The duration is derived from the start and end dates of the workout and takes into account periods that the
        /// workout was paused. Periods that the workout was paused are based off of the workoutEvents property.
        #[unsafe(method(duration))]
        #[unsafe(method_family = none)]
        pub unsafe fn duration(&self) -> NSTimeInterval;

        #[cfg(feature = "HKQuantity")]
        /// The amount of energy that was burned during a workout
        ///
        /// This metric should represent the total active energy burned during the course of the workout. It should be a
        /// quantity with a unit representing energy.
        #[deprecated = "Use statisticsForType: passing the HKQuantityType for HKQuantityTypeIdentifierActiveEnergyBurned"]
        #[unsafe(method(totalEnergyBurned))]
        #[unsafe(method_family = none)]
        pub unsafe fn totalEnergyBurned(&self) -> Option<Retained<HKQuantity>>;

        #[cfg(feature = "HKQuantity")]
        /// The total distance that was traveled during a workout
        ///
        /// This metric should represent the total distance traveled during the course of the workout. It should be a
        /// quantity with a unit representing length.
        #[deprecated = "Use statisticsForType: passing the HKQuantityType for the desired distance type"]
        #[unsafe(method(totalDistance))]
        #[unsafe(method_family = none)]
        pub unsafe fn totalDistance(&self) -> Option<Retained<HKQuantity>>;

        #[cfg(feature = "HKQuantity")]
        /// The total count of swimming strokes that was accumulated during a workout
        ///
        /// This metric should represent the total count of swimming strokes accumulated during the course of the
        /// workout. It should be a quantity with a unit representing count.
        #[deprecated = "Use statisticsForType: passing the HKQuantityType for HKQuantityTypeIdentifierSwimmingStrokeCount"]
        #[unsafe(method(totalSwimmingStrokeCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn totalSwimmingStrokeCount(&self) -> Option<Retained<HKQuantity>>;

        #[cfg(feature = "HKQuantity")]
        /// The total count of flights climbed during a workout
        ///
        /// This metric should represent the total count of flights accumulated during the course of the
        /// workout. It should be a quantity with a unit representing count.
        #[deprecated = "Use statisticsForType: passing the HKQuantityType for HKQuantityTypeIdentifierFlightClimbed"]
        #[unsafe(method(totalFlightsClimbed))]
        #[unsafe(method_family = none)]
        pub unsafe fn totalFlightsClimbed(&self) -> Option<Retained<HKQuantity>>;

        #[cfg(all(feature = "HKObjectType", feature = "HKStatistics"))]
        /// A dictionary of statistics per quantity type during the workout
        ///
        /// This dictionary will contain HKStatistics objects containing the statistics by quantity
        /// sample type for all of the samples that have been added to the workout.
        #[unsafe(method(allStatistics))]
        #[unsafe(method_family = none)]
        pub unsafe fn allStatistics(&self) -> Retained<NSDictionary<HKQuantityType, HKStatistics>>;

        #[cfg(all(feature = "HKObjectType", feature = "HKStatistics"))]
        /// Returns an HKStatistics object containing the statistics for all the samples of the given type that
        /// have been added to the workout. If there are no samples of the given type then nil is returned.
        ///
        ///
        /// Parameter `quantityType`: The quantity type to gather statistics about.
        #[unsafe(method(statisticsForType:))]
        #[unsafe(method_family = none)]
        pub unsafe fn statisticsForType(
            &self,
            quantity_type: &HKQuantityType,
        ) -> Option<Retained<HKStatistics>>;

        /// Parameter `workoutActivityType`: The activity type of the workout
        ///
        /// Parameter `startDate`: The point in time that the workout was started
        ///
        /// Parameter `endDate`: The point in time that the workout was ended
        #[deprecated = "Use HKWorkoutBuilder"]
        #[unsafe(method(workoutWithActivityType:startDate:endDate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutWithActivityType_startDate_endDate(
            workout_activity_type: HKWorkoutActivityType,
            start_date: &NSDate,
            end_date: &NSDate,
        ) -> Retained<Self>;

        #[cfg(feature = "HKQuantity")]
        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
        ///
        ///
        /// Parameter `workoutActivityType`: The activity type of the workout
        ///
        /// Parameter `startDate`: The point in time that the workout was started
        ///
        /// Parameter `endDate`: The point in time that the workout was ended
        ///
        /// Parameter `workoutEvents`: An array of HKWorkoutEvents. The workout's duration is derived from these events. (Optional)
        ///
        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
        ///
        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
        ///
        /// Parameter `metadata`: Metadata for the workout. (Optional)
        ///
        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[deprecated = "Use HKWorkoutBuilder"]
        #[unsafe(method(workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:metadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutWithActivityType_startDate_endDate_workoutEvents_totalEnergyBurned_totalDistance_metadata(
            workout_activity_type: HKWorkoutActivityType,
            start_date: &NSDate,
            end_date: &NSDate,
            workout_events: Option<&NSArray<HKWorkoutEvent>>,
            total_energy_burned: Option<&HKQuantity>,
            total_distance: Option<&HKQuantity>,
            metadata: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "HKDevice", feature = "HKQuantity"))]
        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
        ///
        ///
        /// Parameter `workoutActivityType`: The activity type of the workout
        ///
        /// Parameter `startDate`: The point in time that the workout was started
        ///
        /// Parameter `endDate`: The point in time that the workout was ended
        ///
        /// Parameter `workoutEvents`: An array of HKWorkoutEvents. The workout's duration is derived from these events. (Optional)
        ///
        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
        ///
        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
        ///
        /// Parameter `device`: The HKDevice associated with the workout. (Optional)
        ///
        /// Parameter `metadata`: Metadata for the workout. (Optional)
        ///
        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[deprecated = "Use HKWorkoutBuilder"]
        #[unsafe(method(workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:device:metadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutWithActivityType_startDate_endDate_workoutEvents_totalEnergyBurned_totalDistance_device_metadata(
            workout_activity_type: HKWorkoutActivityType,
            start_date: &NSDate,
            end_date: &NSDate,
            workout_events: Option<&NSArray<HKWorkoutEvent>>,
            total_energy_burned: Option<&HKQuantity>,
            total_distance: Option<&HKQuantity>,
            device: Option<&HKDevice>,
            metadata: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[cfg(feature = "HKQuantity")]
        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
        ///
        ///
        /// Parameter `workoutActivityType`: The activity type of the workout
        ///
        /// Parameter `startDate`: The point in time that the workout was started
        ///
        /// Parameter `endDate`: The point in time that the workout was ended
        ///
        /// Parameter `duration`: The duration of the workout. If 0, the difference between startDate and endDate is used.
        ///
        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
        ///
        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
        ///
        /// Parameter `metadata`: Metadata for the workout. (Optional)
        ///
        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[deprecated = "Use HKWorkoutBuilder"]
        #[unsafe(method(workoutWithActivityType:startDate:endDate:duration:totalEnergyBurned:totalDistance:metadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutWithActivityType_startDate_endDate_duration_totalEnergyBurned_totalDistance_metadata(
            workout_activity_type: HKWorkoutActivityType,
            start_date: &NSDate,
            end_date: &NSDate,
            duration: NSTimeInterval,
            total_energy_burned: Option<&HKQuantity>,
            total_distance: Option<&HKQuantity>,
            metadata: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "HKDevice", feature = "HKQuantity"))]
        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
        ///
        ///
        /// Parameter `workoutActivityType`: The activity type of the workout
        ///
        /// Parameter `startDate`: The point in time that the workout was started
        ///
        /// Parameter `endDate`: The point in time that the workout was ended
        ///
        /// Parameter `duration`: The duration of the workout. If 0, the difference between startDate and endDate is used.
        ///
        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
        ///
        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
        ///
        /// Parameter `device`: The HKDevice associated with the workout. (Optional)
        ///
        /// Parameter `metadata`: Metadata for the workout. (Optional)
        ///
        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[deprecated = "Use HKWorkoutBuilder"]
        #[unsafe(method(workoutWithActivityType:startDate:endDate:duration:totalEnergyBurned:totalDistance:device:metadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutWithActivityType_startDate_endDate_duration_totalEnergyBurned_totalDistance_device_metadata(
            workout_activity_type: HKWorkoutActivityType,
            start_date: &NSDate,
            end_date: &NSDate,
            duration: NSTimeInterval,
            total_energy_burned: Option<&HKQuantity>,
            total_distance: Option<&HKQuantity>,
            device: Option<&HKDevice>,
            metadata: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "HKDevice", feature = "HKQuantity"))]
        /// If the optional total parameters are specified, matching samples that add up to the calculated total quantities
        /// should be associated with this workout using addSamples:toWorkout:completion: in HKHealthStore.
        ///
        ///
        /// Parameter `workoutActivityType`: The activity type of the workout
        ///
        /// Parameter `startDate`: The point in time that the workout was started
        ///
        /// Parameter `endDate`: The point in time that the workout was ended
        ///
        /// Parameter `workoutEvents`: An array of HKWorkoutEvents. The workout's duration is derived from these events. (Optional)
        ///
        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
        ///
        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
        ///
        /// Parameter `totalSwimmingStrokeCount`: The total count of swimming strokes that was accumulated during the workout. (Optional)
        ///
        /// Parameter `device`: The HKDevice associated with the workout. (Optional)
        ///
        /// Parameter `metadata`: Metadata for the workout. (Optional)
        ///
        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[deprecated = "Use HKWorkoutBuilder"]
        #[unsafe(method(workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:totalSwimmingStrokeCount:device:metadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutWithActivityType_startDate_endDate_workoutEvents_totalEnergyBurned_totalDistance_totalSwimmingStrokeCount_device_metadata(
            workout_activity_type: HKWorkoutActivityType,
            start_date: &NSDate,
            end_date: &NSDate,
            workout_events: Option<&NSArray<HKWorkoutEvent>>,
            total_energy_burned: Option<&HKQuantity>,
            total_distance: Option<&HKQuantity>,
            total_swimming_stroke_count: Option<&HKQuantity>,
            device: Option<&HKDevice>,
            metadata: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

        #[cfg(all(feature = "HKDevice", feature = "HKQuantity"))]
        /// If the optional total parameters are specified, matching samples that add up to the calculated total
        /// quantities should be associated with this workout using addSamples:toWorkout:completion: in
        /// HKHealthStore.
        ///
        ///
        /// Parameter `workoutActivityType`: The activity type of the workout
        ///
        /// Parameter `startDate`: The point in time that the workout was started
        ///
        /// Parameter `endDate`: The point in time that the workout was ended
        ///
        /// Parameter `workoutEvents`: An array of HKWorkoutEvents. The workout's duration is derived from these events. (Optional)
        ///
        /// Parameter `totalEnergyBurned`: The amount of energy that was burned during the workout. (Optional)
        ///
        /// Parameter `totalDistance`: The total distance that was traveled during the workout. (Optional)
        ///
        /// Parameter `totalFlightsClimbed`: The total count of flights climbed that was accumulated during the workout. (Optional)
        ///
        /// Parameter `device`: The HKDevice associated with the workout. (Optional)
        ///
        /// Parameter `metadata`: Metadata for the workout. (Optional)
        ///
        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[deprecated = "Use HKWorkoutBuilder"]
        #[unsafe(method(workoutWithActivityType:startDate:endDate:workoutEvents:totalEnergyBurned:totalDistance:totalFlightsClimbed:device:metadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn workoutWithActivityType_startDate_endDate_workoutEvents_totalEnergyBurned_totalDistance_totalFlightsClimbed_device_metadata(
            workout_activity_type: HKWorkoutActivityType,
            start_date: &NSDate,
            end_date: &NSDate,
            workout_events: Option<&NSArray<HKWorkoutEvent>>,
            total_energy_burned: Option<&HKQuantity>,
            total_distance: Option<&HKQuantity>,
            total_flights_climbed: Option<&HKQuantity>,
            device: Option<&HKDevice>,
            metadata: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `HKObject`.
#[cfg(all(feature = "HKObject", feature = "HKSample"))]
impl HKWorkout {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}

/// Methods declared on superclass `NSObject`.
#[cfg(all(feature = "HKObject", feature = "HKSample"))]
impl HKWorkout {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutduration?language=objc)
    pub static HKPredicateKeyPathWorkoutDuration: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttotaldistance?language=objc)
    #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for the desired distance type"]
    pub static HKPredicateKeyPathWorkoutTotalDistance: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttotalenergyburned?language=objc)
    #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierActiveEnergyBurned"]
    pub static HKPredicateKeyPathWorkoutTotalEnergyBurned: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttype?language=objc)
    pub static HKPredicateKeyPathWorkoutType: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttotalswimmingstrokecount?language=objc)
    #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierSwimmingStrokeCount"]
    pub static HKPredicateKeyPathWorkoutTotalSwimmingStrokeCount: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkouttotalflightsclimbed?language=objc)
    #[deprecated = "Use predicateForWorkoutActivitiesWithOperatorType:quantityType:sumQuantity: passing the HKQuantityType for HKQuantityTypeIdentifierFlightsClimbed"]
    pub static HKPredicateKeyPathWorkoutTotalFlightsClimbed: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutsumquantity?language=objc)
    pub static HKPredicateKeyPathWorkoutSumQuantity: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutminimumquantity?language=objc)
    pub static HKPredicateKeyPathWorkoutMinimumQuantity: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutmaximumquantity?language=objc)
    pub static HKPredicateKeyPathWorkoutMaximumQuantity: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutaveragequantity?language=objc)
    pub static HKPredicateKeyPathWorkoutAverageQuantity: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkpredicatekeypathworkoutactivity?language=objc)
    pub static HKPredicateKeyPathWorkoutActivity: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifierduration?language=objc)
    pub static HKWorkoutSortIdentifierDuration: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifiertotaldistance?language=objc)
    pub static HKWorkoutSortIdentifierTotalDistance: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifiertotalenergyburned?language=objc)
    pub static HKWorkoutSortIdentifierTotalEnergyBurned: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifiertotalswimmingstrokecount?language=objc)
    pub static HKWorkoutSortIdentifierTotalSwimmingStrokeCount: &'static NSString;
}

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkworkoutsortidentifiertotalflightsclimbed?language=objc)
    pub static HKWorkoutSortIdentifierTotalFlightsClimbed: &'static NSString;
}