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!(
    /// A calendar event which fires at an absolute time. It can also be used to set up a recurring events which will fire at a scheduled time.
    ///
    ///
    /// Note: : Not all the fields in NSDateComponents are used to calculate the next fire date. Only Month, Day
    /// &
    /// Minutes are used. Other NSDateComponents such as
    /// year, weekday, quarter, week of the year / month are not used in calculation for next fire date.
    /// If its expected to fire on the same day, it should be at least 1 minute ahead or it could get scheduled for the next recurrent day.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmcalendarevent?language=objc)
    #[unsafe(super(HMTimeEvent, HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
    pub struct HMCalendarEvent;
);

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

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

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

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

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

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

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

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

        /// Creates a calendar event
        ///
        ///
        /// Parameter `fireDateComponents`: The date component that specifies the time when the event is fired
        ///
        ///
        /// Note: : Not all the fields in NSDateComponents are used to calculate the next fire date. Only Month, Day
        /// &
        /// Minutes are used. Other NSDateComponents such as
        /// year, weekday, quarter, week of the year / month are not used in calculation for next fire date.
        /// If its expected to fire on the same day, it should be at least 1 minute ahead or it could get scheduled for the next recurrent day.
        ///
        ///
        /// Returns: Instance object representing the event trigger.
        #[unsafe(method(initWithFireDateComponents:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFireDateComponents(
            this: Allocated<Self>,
            fire_date_components: &NSDateComponents,
        ) -> Retained<Self>;

        /// The date component that specifies the time when the event is fired
        ///
        ///
        /// Note: : Not all the fields in NSDateComponents are used to calculate the next fire date. Only Month, Day
        /// &
        /// Minutes are used. Other NSDateComponents such as
        /// year, weekday, quarter, week of the year / month are not used in calculation for next fire date.
        /// If its expected to fire on the same day, it should be at least 1 minute ahead or it could get scheduled for the next recurrent day.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(fireDateComponents))]
        #[unsafe(method_family = none)]
        pub unsafe fn fireDateComponents(&self) -> Retained<NSDateComponents>;
    );
}

/// Methods declared on superclass `HMEvent`.
#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
impl HMCalendarEvent {
    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 calendar event.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmmutablecalendarevent?language=objc)
    #[unsafe(super(HMCalendarEvent, HMTimeEvent, HMEvent, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
    pub struct HMMutableCalendarEvent;
);

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

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

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

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

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

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

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

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

        /// The date component that specifies the time when the event is fired
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(fireDateComponents))]
        #[unsafe(method_family = none)]
        pub unsafe fn fireDateComponents(&self) -> Retained<NSDateComponents>;

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

/// Methods declared on superclass `HMCalendarEvent`.
#[cfg(all(feature = "HMEvent", feature = "HMTimeEvent"))]
impl HMMutableCalendarEvent {
    extern_methods!(
        /// Creates a calendar event
        ///
        ///
        /// Parameter `fireDateComponents`: The date component that specifies the time when the event is fired
        ///
        ///
        /// Note: : Not all the fields in NSDateComponents are used to calculate the next fire date. Only Month, Day
        /// &
        /// Minutes are used. Other NSDateComponents such as
        /// year, weekday, quarter, week of the year / month are not used in calculation for next fire date.
        /// If its expected to fire on the same day, it should be at least 1 minute ahead or it could get scheduled for the next recurrent day.
        ///
        ///
        /// Returns: Instance object representing the event trigger.
        #[unsafe(method(initWithFireDateComponents:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithFireDateComponents(
            this: Allocated<Self>,
            fire_date_components: &NSDateComponents,
        ) -> Retained<Self>;
    );
}

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