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 represents a collection of action objects that can be executed.
    /// The order of execution of these actions is undefined.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionset?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct HMActionSet;
);

unsafe impl Send for HMActionSet {}

unsafe impl Sync for HMActionSet {}

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

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

        /// The name of the action set.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(name))]
        #[unsafe(method_family = none)]
        pub unsafe fn name(&self) -> Retained<NSString>;

        #[cfg(feature = "HMAction")]
        /// Set of HMAction objects that represent the individual items of the action set.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(actions))]
        #[unsafe(method_family = none)]
        pub unsafe fn actions(&self) -> Retained<NSSet<HMAction>>;

        /// Specifies whether the action set is currently executing or not.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(isExecuting))]
        #[unsafe(method_family = none)]
        pub unsafe fn isExecuting(&self) -> bool;

        /// Specifies the action set type - user-defined, trigger-owned or one of the builtin types.
        /// Builtin action sets cannot be removed from the home. trigger-owned action sets cannot
        /// be executed, renamed or associated with another trigger.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(actionSetType))]
        #[unsafe(method_family = none)]
        pub unsafe fn actionSetType(&self) -> Retained<NSString>;

        /// A unique identifier for the action set.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(uniqueIdentifier))]
        #[unsafe(method_family = none)]
        pub unsafe fn uniqueIdentifier(&self) -> Retained<NSUUID>;

        /// Specifies the last execution date for the action set.
        ///
        /// This property is not atomic.
        ///
        /// # Safety
        ///
        /// This might not be thread-safe.
        #[unsafe(method(lastExecutionDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn lastExecutionDate(&self) -> Option<Retained<NSDate>>;

        #[cfg(all(feature = "HMDefines", feature = "block2"))]
        /// This method is used to change the name of the action set.
        ///
        ///
        /// Parameter `name`: New name for the action set.
        ///
        ///
        /// Parameter `completion`: Block that is invoked once the request is processed.
        /// The NSError provides more information on the status of the request, error
        /// will be nil on success.
        ///
        /// # Safety
        ///
        /// `completion` must be a valid pointer.
        #[unsafe(method(updateName:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn updateName_completionHandler(
            &self,
            name: &NSString,
            completion: HMErrorBlock,
        );

        #[cfg(all(feature = "HMAction", feature = "HMDefines", feature = "block2"))]
        /// Adds an action to the action set.
        ///
        ///
        /// Parameter `action`: Action object to add to the action set.
        ///
        ///
        /// Parameter `completion`: Block that is invoked once the request is processed.
        /// The NSError provides more information on the status of the request, error
        /// will be nil on success.
        ///
        /// # Safety
        ///
        /// `completion` must be a valid pointer.
        #[unsafe(method(addAction:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn addAction_completionHandler(
            &self,
            action: &HMAction,
            completion: HMErrorBlock,
        );

        #[cfg(all(feature = "HMAction", feature = "HMDefines", feature = "block2"))]
        /// Removes an existing action from the action set.
        ///
        ///
        /// Parameter `action`: Action object to remove from the action set.
        ///
        ///
        /// Parameter `completion`: Block that is invoked once the request is processed.
        /// The NSError provides more information on the status of the request, error
        /// will be nil on success.
        ///
        /// # Safety
        ///
        /// `completion` must be a valid pointer.
        #[unsafe(method(removeAction:completionHandler:))]
        #[unsafe(method_family = none)]
        pub unsafe fn removeAction_completionHandler(
            &self,
            action: &HMAction,
            completion: HMErrorBlock,
        );
    );
}

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

extern "C" {
    /// Builtin action set type for WakeUp.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypewakeup?language=objc)
    pub static HMActionSetTypeWakeUp: &'static NSString;
}

extern "C" {
    /// Type for builtin action set Sleep.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypesleep?language=objc)
    pub static HMActionSetTypeSleep: &'static NSString;
}

extern "C" {
    /// Type for builtin action set HomeDeparture.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypehomedeparture?language=objc)
    pub static HMActionSetTypeHomeDeparture: &'static NSString;
}

extern "C" {
    /// Type for builtin action set HomeArrival.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypehomearrival?language=objc)
    pub static HMActionSetTypeHomeArrival: &'static NSString;
}

extern "C" {
    /// Type for user-defined action sets.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypeuserdefined?language=objc)
    pub static HMActionSetTypeUserDefined: &'static NSString;
}

extern "C" {
    /// Type for trigger-owned action sets.
    ///
    ///
    /// An action set of this type is owned by a trigger and is not listed
    /// as part of the home. An action set of this type cannot be executed,
    /// renamed, or associated with a different trigger.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/homekit/hmactionsettypetriggerowned?language=objc)
    pub static HMActionSetTypeTriggerOwned: &'static NSString;
}