//! 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::*;

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewanimatingstate?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewAnimatingState(pub NSInteger);
impl UIViewAnimatingState {
    #[doc(alias = "UIViewAnimatingStateInactive")]
    pub const Inactive: Self = Self(0);
    #[doc(alias = "UIViewAnimatingStateActive")]
    pub const Active: Self = Self(1);
    #[doc(alias = "UIViewAnimatingStateStopped")]
    pub const Stopped: Self = Self(2);
}

unsafe impl Encode for UIViewAnimatingState {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIViewAnimatingState {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewanimatingposition?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct UIViewAnimatingPosition(pub NSInteger);
impl UIViewAnimatingPosition {
    #[doc(alias = "UIViewAnimatingPositionEnd")]
    pub const End: Self = Self(0);
    #[doc(alias = "UIViewAnimatingPositionStart")]
    pub const Start: Self = Self(1);
    #[doc(alias = "UIViewAnimatingPositionCurrent")]
    pub const Current: Self = Self(2);
}

unsafe impl Encode for UIViewAnimatingPosition {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for UIViewAnimatingPosition {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewanimating?language=objc)
    pub unsafe trait UIViewAnimating: NSObjectProtocol + MainThreadOnly {
        #[unsafe(method(state))]
        #[unsafe(method_family = none)]
        fn state(&self) -> UIViewAnimatingState;

        #[unsafe(method(isRunning))]
        #[unsafe(method_family = none)]
        fn isRunning(&self) -> bool;

        #[unsafe(method(isReversed))]
        #[unsafe(method_family = none)]
        fn isReversed(&self) -> bool;

        /// Setter for [`isReversed`][Self::isReversed].
        #[unsafe(method(setReversed:))]
        #[unsafe(method_family = none)]
        fn setReversed(&self, reversed: bool);

        #[cfg(feature = "objc2-core-foundation")]
        #[unsafe(method(fractionComplete))]
        #[unsafe(method_family = none)]
        fn fractionComplete(&self) -> CGFloat;

        #[cfg(feature = "objc2-core-foundation")]
        /// Setter for [`fractionComplete`][Self::fractionComplete].
        #[unsafe(method(setFractionComplete:))]
        #[unsafe(method_family = none)]
        fn setFractionComplete(&self, fraction_complete: CGFloat);

        #[unsafe(method(startAnimation))]
        #[unsafe(method_family = none)]
        fn startAnimation(&self);

        #[unsafe(method(startAnimationAfterDelay:))]
        #[unsafe(method_family = none)]
        fn startAnimationAfterDelay(&self, delay: NSTimeInterval);

        #[unsafe(method(pauseAnimation))]
        #[unsafe(method_family = none)]
        fn pauseAnimation(&self);

        #[unsafe(method(stopAnimation:))]
        #[unsafe(method_family = none)]
        fn stopAnimation(&self, without_finishing: bool);

        #[unsafe(method(finishAnimationAtPosition:))]
        #[unsafe(method_family = none)]
        fn finishAnimationAtPosition(&self, final_position: UIViewAnimatingPosition);
    }
);

extern_protocol!(
    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiviewimplicitlyanimating?language=objc)
    pub unsafe trait UIViewImplicitlyAnimating: UIViewAnimating + MainThreadOnly {
        #[cfg(all(feature = "block2", feature = "objc2-core-foundation"))]
        #[optional]
        #[unsafe(method(addAnimations:delayFactor:))]
        #[unsafe(method_family = none)]
        fn addAnimations_delayFactor(
            &self,
            animation: &block2::DynBlock<dyn Fn()>,
            delay_factor: CGFloat,
        );

        #[cfg(feature = "block2")]
        #[optional]
        #[unsafe(method(addAnimations:))]
        #[unsafe(method_family = none)]
        fn addAnimations(&self, animation: &block2::DynBlock<dyn Fn()>);

        #[cfg(feature = "block2")]
        #[optional]
        #[unsafe(method(addCompletion:))]
        #[unsafe(method_family = none)]
        fn addCompletion(&self, completion: &block2::DynBlock<dyn Fn(UIViewAnimatingPosition)>);

        #[cfg(all(feature = "UITimingCurveProvider", feature = "objc2-core-foundation"))]
        #[optional]
        #[unsafe(method(continueAnimationWithTimingParameters:durationFactor:))]
        #[unsafe(method_family = none)]
        fn continueAnimationWithTimingParameters_durationFactor(
            &self,
            parameters: Option<&ProtocolObject<dyn UITimingCurveProvider>>,
            duration_factor: CGFloat,
        );
    }
);
