objc2-health-kit 0.3.2

Bindings to the HealthKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

/// A general region of pleasantness derived from valence logged on a state of mind sample.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmindvalenceclassification?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct HKStateOfMindValenceClassification(pub NSInteger);
impl HKStateOfMindValenceClassification {
    #[doc(alias = "HKStateOfMindValenceClassificationVeryUnpleasant")]
    pub const VeryUnpleasant: Self = Self(1);
    #[doc(alias = "HKStateOfMindValenceClassificationUnpleasant")]
    pub const Unpleasant: Self = Self(2);
    #[doc(alias = "HKStateOfMindValenceClassificationSlightlyUnpleasant")]
    pub const SlightlyUnpleasant: Self = Self(3);
    #[doc(alias = "HKStateOfMindValenceClassificationNeutral")]
    pub const Neutral: Self = Self(4);
    #[doc(alias = "HKStateOfMindValenceClassificationSlightlyPleasant")]
    pub const SlightlyPleasant: Self = Self(5);
    #[doc(alias = "HKStateOfMindValenceClassificationPleasant")]
    pub const Pleasant: Self = Self(6);
    #[doc(alias = "HKStateOfMindValenceClassificationVeryPleasant")]
    pub const VeryPleasant: Self = Self(7);
}

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

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

impl HKStateOfMindValenceClassification {
    /// Returns the valence classification appropriate for a valence value.
    /// If the given valence is outside the supported range of values, this function returns
    /// `nil.`
    #[doc(alias = "HKStateOfMindValenceClassificationForValence")]
    #[inline]
    pub unsafe fn for_valence(valence: c_double) -> Option<Retained<NSNumber>> {
        extern "C-unwind" {
            fn HKStateOfMindValenceClassificationForValence(valence: c_double) -> *mut NSNumber;
        }
        let ret = unsafe { HKStateOfMindValenceClassificationForValence(valence) };
        unsafe { Retained::retain_autoreleased(ret) }
    }
}

/// A specific word describing a felt experience.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmindlabel?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct HKStateOfMindLabel(pub NSInteger);
impl HKStateOfMindLabel {
    #[doc(alias = "HKStateOfMindLabelAmazed")]
    pub const Amazed: Self = Self(1);
    #[doc(alias = "HKStateOfMindLabelAmused")]
    pub const Amused: Self = Self(2);
    #[doc(alias = "HKStateOfMindLabelAngry")]
    pub const Angry: Self = Self(3);
    #[doc(alias = "HKStateOfMindLabelAnxious")]
    pub const Anxious: Self = Self(4);
    #[doc(alias = "HKStateOfMindLabelAshamed")]
    pub const Ashamed: Self = Self(5);
    #[doc(alias = "HKStateOfMindLabelBrave")]
    pub const Brave: Self = Self(6);
    #[doc(alias = "HKStateOfMindLabelCalm")]
    pub const Calm: Self = Self(7);
    #[doc(alias = "HKStateOfMindLabelContent")]
    pub const Content: Self = Self(8);
    #[doc(alias = "HKStateOfMindLabelDisappointed")]
    pub const Disappointed: Self = Self(9);
    #[doc(alias = "HKStateOfMindLabelDiscouraged")]
    pub const Discouraged: Self = Self(10);
    #[doc(alias = "HKStateOfMindLabelDisgusted")]
    pub const Disgusted: Self = Self(11);
    #[doc(alias = "HKStateOfMindLabelEmbarrassed")]
    pub const Embarrassed: Self = Self(12);
    #[doc(alias = "HKStateOfMindLabelExcited")]
    pub const Excited: Self = Self(13);
    #[doc(alias = "HKStateOfMindLabelFrustrated")]
    pub const Frustrated: Self = Self(14);
    #[doc(alias = "HKStateOfMindLabelGrateful")]
    pub const Grateful: Self = Self(15);
    #[doc(alias = "HKStateOfMindLabelGuilty")]
    pub const Guilty: Self = Self(16);
    #[doc(alias = "HKStateOfMindLabelHappy")]
    pub const Happy: Self = Self(17);
    #[doc(alias = "HKStateOfMindLabelHopeless")]
    pub const Hopeless: Self = Self(18);
    #[doc(alias = "HKStateOfMindLabelIrritated")]
    pub const Irritated: Self = Self(19);
    #[doc(alias = "HKStateOfMindLabelJealous")]
    pub const Jealous: Self = Self(20);
    #[doc(alias = "HKStateOfMindLabelJoyful")]
    pub const Joyful: Self = Self(21);
    #[doc(alias = "HKStateOfMindLabelLonely")]
    pub const Lonely: Self = Self(22);
    #[doc(alias = "HKStateOfMindLabelPassionate")]
    pub const Passionate: Self = Self(23);
    #[doc(alias = "HKStateOfMindLabelPeaceful")]
    pub const Peaceful: Self = Self(24);
    #[doc(alias = "HKStateOfMindLabelProud")]
    pub const Proud: Self = Self(25);
    #[doc(alias = "HKStateOfMindLabelRelieved")]
    pub const Relieved: Self = Self(26);
    #[doc(alias = "HKStateOfMindLabelSad")]
    pub const Sad: Self = Self(27);
    #[doc(alias = "HKStateOfMindLabelScared")]
    pub const Scared: Self = Self(28);
    #[doc(alias = "HKStateOfMindLabelStressed")]
    pub const Stressed: Self = Self(29);
    #[doc(alias = "HKStateOfMindLabelSurprised")]
    pub const Surprised: Self = Self(30);
    #[doc(alias = "HKStateOfMindLabelWorried")]
    pub const Worried: Self = Self(31);
    #[doc(alias = "HKStateOfMindLabelAnnoyed")]
    pub const Annoyed: Self = Self(32);
    #[doc(alias = "HKStateOfMindLabelConfident")]
    pub const Confident: Self = Self(33);
    #[doc(alias = "HKStateOfMindLabelDrained")]
    pub const Drained: Self = Self(34);
    #[doc(alias = "HKStateOfMindLabelHopeful")]
    pub const Hopeful: Self = Self(35);
    #[doc(alias = "HKStateOfMindLabelIndifferent")]
    pub const Indifferent: Self = Self(36);
    #[doc(alias = "HKStateOfMindLabelOverwhelmed")]
    pub const Overwhelmed: Self = Self(37);
    #[doc(alias = "HKStateOfMindLabelSatisfied")]
    pub const Satisfied: Self = Self(38);
}

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

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

/// A general facet of life with which a felt experience may be associated.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmindassociation?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct HKStateOfMindAssociation(pub NSInteger);
impl HKStateOfMindAssociation {
    #[doc(alias = "HKStateOfMindAssociationCommunity")]
    pub const Community: Self = Self(1);
    #[doc(alias = "HKStateOfMindAssociationCurrentEvents")]
    pub const CurrentEvents: Self = Self(2);
    #[doc(alias = "HKStateOfMindAssociationDating")]
    pub const Dating: Self = Self(3);
    #[doc(alias = "HKStateOfMindAssociationEducation")]
    pub const Education: Self = Self(4);
    #[doc(alias = "HKStateOfMindAssociationFamily")]
    pub const Family: Self = Self(5);
    #[doc(alias = "HKStateOfMindAssociationFitness")]
    pub const Fitness: Self = Self(6);
    #[doc(alias = "HKStateOfMindAssociationFriends")]
    pub const Friends: Self = Self(7);
    #[doc(alias = "HKStateOfMindAssociationHealth")]
    pub const Health: Self = Self(8);
    #[doc(alias = "HKStateOfMindAssociationHobbies")]
    pub const Hobbies: Self = Self(9);
    #[doc(alias = "HKStateOfMindAssociationIdentity")]
    pub const Identity: Self = Self(10);
    #[doc(alias = "HKStateOfMindAssociationMoney")]
    pub const Money: Self = Self(11);
    #[doc(alias = "HKStateOfMindAssociationPartner")]
    pub const Partner: Self = Self(12);
    #[doc(alias = "HKStateOfMindAssociationSelfCare")]
    pub const SelfCare: Self = Self(13);
    #[doc(alias = "HKStateOfMindAssociationSpirituality")]
    pub const Spirituality: Self = Self(14);
    #[doc(alias = "HKStateOfMindAssociationTasks")]
    pub const Tasks: Self = Self(15);
    #[doc(alias = "HKStateOfMindAssociationTravel")]
    pub const Travel: Self = Self(16);
    #[doc(alias = "HKStateOfMindAssociationWork")]
    pub const Work: Self = Self(17);
    #[doc(alias = "HKStateOfMindAssociationWeather")]
    pub const Weather: Self = Self(18);
}

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

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

/// The kind of feeling type captured by a state of mind log, considering the period of time the reflection concerns.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmindkind?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct HKStateOfMindKind(pub NSInteger);
impl HKStateOfMindKind {
    #[doc(alias = "HKStateOfMindKindMomentaryEmotion")]
    pub const MomentaryEmotion: Self = Self(1);
    #[doc(alias = "HKStateOfMindKindDailyMood")]
    pub const DailyMood: Self = Self(2);
}

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

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

extern_class!(
    /// Represents how one feels, including descriptors of a feeling and optionally, its source.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/healthkit/hkstateofmind?language=objc)
    #[unsafe(super(HKSample, HKObject, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "HKObject", feature = "HKSample"))]
    pub struct HKStateOfMind;
);

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

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

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

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

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
unsafe impl CopyingHelper for HKStateOfMind {
    type Result = Self;
}

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

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

#[cfg(all(feature = "HKObject", feature = "HKSample"))]
impl HKStateOfMind {
    extern_methods!(
        /// A description of the kind of feeling type captured by this state of mind.
        ///
        /// Feeling types can be understood by the timeframe considered to create this log, possibly indicated by the context used to create it.
        /// For example, a `momentary emotion` log might be in response to 'how are you feeling right now?' while a `daily mood` log
        /// might be in response to 'how have you been feeling today?'.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(kind))]
        #[unsafe(method_family = none)]
        pub unsafe fn kind(&self) -> HKStateOfMindKind;

        /// A signed, self-reported measure of how positive or negative one is feeling, on a continuous scale from -1 to +1.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(valence))]
        #[unsafe(method_family = none)]
        pub unsafe fn valence(&self) -> c_double;

        /// A general region of pleasantness based on this sample's valence value.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(valenceClassification))]
        #[unsafe(method_family = none)]
        pub unsafe fn valenceClassification(&self) -> HKStateOfMindValenceClassification;

        /// Zero or more specific sentiments selected to represent a felt experience.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(labels))]
        #[unsafe(method_family = none)]
        pub unsafe fn labels(&self) -> Retained<NSArray<NSNumber>>;

        /// Zero or more facets of life with which this felt experience is associated.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(associations))]
        #[unsafe(method_family = none)]
        pub unsafe fn associations(&self) -> Retained<NSArray<NSNumber>>;

        /// Creates a new log describing an experienced emotion at a moment in time.
        #[unsafe(method(stateOfMindWithDate:kind:valence:labels:associations:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stateOfMindWithDate_kind_valence_labels_associations(
            date: &NSDate,
            kind: HKStateOfMindKind,
            valence: c_double,
            labels: &NSArray<NSNumber>,
            associations: &NSArray<NSNumber>,
        ) -> Retained<Self>;

        /// Creates a new log describing an experienced emotion at a moment in time.
        ///
        /// # Safety
        ///
        /// `metadata` generic should be of the correct type.
        #[unsafe(method(stateOfMindWithDate:kind:valence:labels:associations:metadata:))]
        #[unsafe(method_family = none)]
        pub unsafe fn stateOfMindWithDate_kind_valence_labels_associations_metadata(
            date: &NSDate,
            kind: HKStateOfMindKind,
            valence: c_double,
            labels: &NSArray<NSNumber>,
            associations: &NSArray<NSNumber>,
            metadata: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Retained<Self>;

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

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

#[deprecated = "renamed to `HKStateOfMindValenceClassification::for_valence`"]
#[inline]
pub unsafe extern "C-unwind" fn HKStateOfMindValenceClassificationForValence(
    valence: c_double,
) -> Option<Retained<NSNumber>> {
    extern "C-unwind" {
        fn HKStateOfMindValenceClassificationForValence(valence: c_double) -> *mut NSNumber;
    }
    let ret = unsafe { HKStateOfMindValenceClassificationForValence(valence) };
    unsafe { Retained::retain_autoreleased(ret) }
}