objc2-safety-kit 0.3.2

Bindings to the SafetyKit framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-location")]
use objc2_core_location::*;
use objc2_foundation::*;

use crate::*;

/// This enumeration defines possible emergency responses to a crash event
///
/// See also: SACrashDetectionEventResponse
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/safetykit/sacrashdetectioneventresponse?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct SACrashDetectionEventResponse(pub NSInteger);
impl SACrashDetectionEventResponse {
    /// Emergency SOS response for the crash event was attempted
    #[doc(alias = "SACrashDetectionEventResponseAttempted")]
    pub const Attempted: Self = Self(0);
    /// Emergency SOS response for crash events is disabled
    #[doc(alias = "SACrashDetectionEventResponseDisabled")]
    pub const Disabled: Self = Self(1);
}

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

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

extern_class!(
    /// This object describes a Crash Detection event and response to it.
    ///
    /// See also: SACrashDetectionEvent
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/safetykit/sacrashdetectionevent?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct SACrashDetectionEvent;
);

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

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

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

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

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

impl SACrashDetectionEvent {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

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

        /// date
        ///
        ///
        /// The time a crash was detected
        #[unsafe(method(date))]
        #[unsafe(method_family = none)]
        pub unsafe fn date(&self) -> Retained<NSDate>;

        /// response
        ///
        ///
        /// enum value representing the emergency response to the Crash Detection event
        ///
        ///
        /// See also: SACrashDetectionEventResponse
        #[unsafe(method(response))]
        #[unsafe(method_family = none)]
        pub unsafe fn response(&self) -> SACrashDetectionEventResponse;

        #[cfg(feature = "objc2-core-location")]
        /// location
        ///
        ///
        /// Location information describing the geographical location of where the Crash Detection occurred.
        ///
        ///
        /// See also: CLLocation
        #[unsafe(method(location))]
        #[unsafe(method_family = none)]
        pub unsafe fn location(&self) -> Option<Retained<CLLocation>>;
    );
}