//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

// 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);
}

// 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!(
    pub unsafe trait UIViewAnimating: NSObjectProtocol + IsMainThreadOnly {
        #[method(state)]
        unsafe fn state(&self) -> UIViewAnimatingState;

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

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

        #[method(setReversed:)]
        unsafe fn setReversed(&self, reversed: bool);

        #[method(fractionComplete)]
        unsafe fn fractionComplete(&self) -> CGFloat;

        #[method(setFractionComplete:)]
        unsafe fn setFractionComplete(&self, fraction_complete: CGFloat);

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

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

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

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

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

    unsafe impl ProtocolType for dyn UIViewAnimating {}
);

extern_protocol!(
    pub unsafe trait UIViewImplicitlyAnimating: UIViewAnimating + IsMainThreadOnly {
        #[cfg(feature = "block2")]
        #[optional]
        #[method(addAnimations:delayFactor:)]
        unsafe fn addAnimations_delayFactor(
            &self,
            animation: &block2::Block<dyn Fn()>,
            delay_factor: CGFloat,
        );

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

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

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

    unsafe impl ProtocolType for dyn UIViewImplicitlyAnimating {}
);
