//! 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::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/quartzcore/catransaction?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct CATransaction;
);

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

impl CATransaction {
    extern_methods!(
        #[unsafe(method(begin))]
        #[unsafe(method_family = none)]
        pub fn begin();

        #[unsafe(method(commit))]
        #[unsafe(method_family = none)]
        pub fn commit();

        #[unsafe(method(flush))]
        #[unsafe(method_family = none)]
        pub fn flush();

        #[unsafe(method(lock))]
        #[unsafe(method_family = none)]
        pub unsafe fn lock();

        #[unsafe(method(unlock))]
        #[unsafe(method_family = none)]
        pub unsafe fn unlock();

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(animationDuration))]
        #[unsafe(method_family = none)]
        pub fn animationDuration() -> CFTimeInterval;

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(setAnimationDuration:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationDuration(dur: CFTimeInterval);

        #[cfg(feature = "CAMediaTimingFunction")]
        #[unsafe(method(animationTimingFunction))]
        #[unsafe(method_family = none)]
        pub fn animationTimingFunction() -> Option<Retained<CAMediaTimingFunction>>;

        #[cfg(feature = "CAMediaTimingFunction")]
        #[unsafe(method(setAnimationTimingFunction:))]
        #[unsafe(method_family = none)]
        pub fn setAnimationTimingFunction(function: Option<&CAMediaTimingFunction>);

        #[unsafe(method(disableActions))]
        #[unsafe(method_family = none)]
        pub fn disableActions() -> bool;

        #[unsafe(method(setDisableActions:))]
        #[unsafe(method_family = none)]
        pub fn setDisableActions(flag: bool);

        #[cfg(feature = "block2")]
        #[unsafe(method(completionBlock))]
        #[unsafe(method_family = none)]
        pub unsafe fn completionBlock() -> *mut block2::DynBlock<dyn Fn()>;

        #[cfg(feature = "block2")]
        #[unsafe(method(setCompletionBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setCompletionBlock(block: Option<&block2::DynBlock<dyn Fn()>>);

        #[unsafe(method(valueForKey:))]
        #[unsafe(method_family = none)]
        pub fn valueForKey(key: &NSString) -> Option<Retained<AnyObject>>;

        /// # Safety
        ///
        /// `an_object` should be of the correct type.
        #[unsafe(method(setValue:forKey:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setValue_forKey(an_object: Option<&AnyObject>, key: &NSString);
    );
}

/// Methods declared on superclass `NSObject`.
impl CATransaction {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}

extern "C" {
    /// Transaction property ids. *
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/quartzcore/kcatransactionanimationduration?language=objc)
    pub static kCATransactionAnimationDuration: &'static NSString;
}

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

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

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