objc2-home-kit 0.3.2

Bindings to the HomeKit 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::*;

extern_class!(
    /// This class is used to represent a significant time event.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmsignificanttimeevent?language=objc)
    #[unsafe(super(HMTimeEvent, HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
    pub struct HMSignificantTimeEvent;
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl Send for HMSignificantTimeEvent {}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl Sync for HMSignificantTimeEvent {}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSCopying for HMSignificantTimeEvent {}
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl CopyingHelper for HMSignificantTimeEvent {
    type Result = Self;
}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSMutableCopying for HMSignificantTimeEvent {}
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl MutableCopyingHelper for HMSignificantTimeEvent {
    type Result = HMMutableSignificantTimeEvent;
}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for HMSignificantTimeEvent {}
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
impl HMSignificantTimeEvent {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "HMSignificantEvents")]
        /// Creates a significant time event.
        ///
        ///
        /// Parameter `significantEvent`: The significant event for the trigger.
        ///
        ///
        /// Parameter `offset`: An offset from the time of the significant event. To specify an offset before the significant event, the
        /// properties of the NSDateComponents must be negative value. e.g. To specify 30 mins before sunset, the
        /// 'minute' property must be set to -30.
        ///
        ///
        /// Returns: Instance object representing the significant event.
        #[unsafe(method(initWithSignificantEvent:offset:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSignificantEvent_offset(
            this: Allocated<Self>,
            significant_event: &HMSignificantEvent,
            offset: Option<&NSDateComponents>,
        ) -> Retained<Self>;

        #[cfg(feature = "HMSignificantEvents")]
        /// significantEvent The significant event for the trigger.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(significantEvent))]
        #[unsafe(method_family = none)]
        pub unsafe fn significantEvent(&self) -> Retained<HMSignificantEvent>;

        /// offset An offset from the time of the significant event. To specify an offset before the significant event, the
        /// properties of the NSDateComponents must be negative value. e.g. To specify 30 mins before sunset, the
        /// 'minute' property must be set to -30.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(offset))]
        #[unsafe(method_family = none)]
        pub unsafe fn offset(&self) -> Option<Retained<NSDateComponents>>;
    );
}

/// Methods declared on superclass `HMEvent`.
#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
impl HMSignificantTimeEvent {
    extern_methods!(
        #[deprecated = "HMEvent is abstract"]
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern_class!(
    /// This class is used to represent a significant time event.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutablesignificanttimeevent?language=objc)
    #[unsafe(super(HMSignificantTimeEvent, HMTimeEvent, HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
    pub struct HMMutableSignificantTimeEvent;
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl Send for HMMutableSignificantTimeEvent {}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl Sync for HMMutableSignificantTimeEvent {}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSCopying for HMMutableSignificantTimeEvent {}
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl CopyingHelper for HMMutableSignificantTimeEvent {
    type Result = HMSignificantTimeEvent;
}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSMutableCopying for HMMutableSignificantTimeEvent {}
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
unsafe impl MutableCopyingHelper for HMMutableSignificantTimeEvent {
    type Result = Self;
}

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
extern_conformance!(
    unsafe impl NSObjectProtocol for HMMutableSignificantTimeEvent {}
);

#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
impl HMMutableSignificantTimeEvent {
    extern_methods!(
        #[cfg(feature = "HMSignificantEvents")]
        /// significantEvent The significant event for the trigger.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(significantEvent))]
        #[unsafe(method_family = none)]
        pub unsafe fn significantEvent(&self) -> Retained<HMSignificantEvent>;

        #[cfg(feature = "HMSignificantEvents")]
        /// Setter for [`significantEvent`][Self::significantEvent].
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setSignificantEvent:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setSignificantEvent(&self, significant_event: &HMSignificantEvent);

        /// offset An offset from the time of the significant event. To specify an offset before the significant event, the
        /// properties of the NSDateComponents must be negative value. e.g. To specify 30 mins before sunset, the
        /// 'minute' property must be set to -30.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(offset))]
        #[unsafe(method_family = none)]
        pub unsafe fn offset(&self) -> Retained<NSDateComponents>;

        /// Setter for [`offset`][Self::offset].
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(setOffset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setOffset(&self, offset: &NSDateComponents);
    );
}

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

        #[cfg(feature = "HMSignificantEvents")]
        /// Creates a significant time event.
        ///
        ///
        /// Parameter `significantEvent`: The significant event for the trigger.
        ///
        ///
        /// Parameter `offset`: An offset from the time of the significant event. To specify an offset before the significant event, the
        /// properties of the NSDateComponents must be negative value. e.g. To specify 30 mins before sunset, the
        /// 'minute' property must be set to -30.
        ///
        ///
        /// Returns: Instance object representing the significant event.
        #[unsafe(method(initWithSignificantEvent:offset:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithSignificantEvent_offset(
            this: Allocated<Self>,
            significant_event: &HMSignificantEvent,
            offset: Option<&NSDateComponents>,
        ) -> Retained<Self>;
    );
}

/// Methods declared on superclass `HMEvent`.
#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
impl HMMutableSignificantTimeEvent {
    extern_methods!(
        #[deprecated = "HMEvent is abstract"]
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}