//! 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_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsuseractivityrestoring?language=objc)
    pub unsafe trait NSUserActivityRestoring: NSObjectProtocol + MainThreadOnly {
        #[unsafe(method(restoreUserActivityState:))]
        #[unsafe(method_family = none)]
        fn restoreUserActivityState(&self, user_activity: &NSUserActivity);
    }
);

/// NSUserActivity.
#[cfg(feature = "NSResponder")]
impl NSResponder {
    extern_methods!(
        #[unsafe(method(userActivity))]
        #[unsafe(method_family = none)]
        pub fn userActivity(&self) -> Option<Retained<NSUserActivity>>;

        /// Setter for [`userActivity`][Self::userActivity].
        #[unsafe(method(setUserActivity:))]
        #[unsafe(method_family = none)]
        pub fn setUserActivity(&self, user_activity: Option<&NSUserActivity>);

        #[unsafe(method(updateUserActivityState:))]
        #[unsafe(method_family = none)]
        pub fn updateUserActivityState(&self, user_activity: &NSUserActivity);
    );
}

#[cfg(feature = "NSResponder")]
extern_conformance!(
    unsafe impl NSUserActivityRestoring for NSResponder {}
);

/// NSUserActivity.
#[cfg(feature = "NSDocument")]
impl NSDocument {
    extern_methods!(
        #[unsafe(method(userActivity))]
        #[unsafe(method_family = none)]
        pub fn userActivity(&self) -> Option<Retained<NSUserActivity>>;

        /// Setter for [`userActivity`][Self::userActivity].
        #[unsafe(method(setUserActivity:))]
        #[unsafe(method_family = none)]
        pub fn setUserActivity(&self, user_activity: Option<&NSUserActivity>);

        #[unsafe(method(updateUserActivityState:))]
        #[unsafe(method_family = none)]
        pub fn updateUserActivityState(&self, activity: &NSUserActivity);
    );
}

#[cfg(feature = "NSDocument")]
extern_conformance!(
    unsafe impl NSUserActivityRestoring for NSDocument {}
);

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsuseractivitydocumenturlkey?language=objc)
    pub static NSUserActivityDocumentURLKey: &'static NSString;
}
