using System;
using UnityEngine;

namespace Jovian.PopupSystem {
    /// <summary>
    /// Interface for popup show/hide animations. Each registered category gets its own instance
    /// to prevent state corruption during concurrent animations. Driven by float timers in
    /// <see cref="Tick"/>, not coroutines.
    /// </summary>
    public interface IPopupAnimator {
        /// <summary>
        /// Begins a show animation on the given CanvasGroup. Typically fades alpha from 0 to 1.
        /// </summary>
        /// <param name="canvasGroup">The CanvasGroup to animate.</param>
        /// <param name="duration">Animation duration in seconds.</param>
        /// <param name="onComplete">Callback invoked when the animation finishes. May be null.</param>
        void Show(CanvasGroup canvasGroup, float duration, Action onComplete);

        /// <summary>
        /// Begins a hide animation on the given CanvasGroup. Typically fades alpha to 0.
        /// </summary>
        /// <param name="canvasGroup">The CanvasGroup to animate.</param>
        /// <param name="duration">Animation duration in seconds.</param>
        /// <param name="onComplete">Callback invoked when the animation finishes. May be null.</param>
        void Hide(CanvasGroup canvasGroup, float duration, Action onComplete);

        /// <summary>
        /// Advances the animation by deltaTime. Call every frame from <see cref="IPopupSystem.Tick"/>.
        /// </summary>
        void Tick(float deltaTime);

        /// <summary>
        /// True if an animation is currently in progress.
        /// </summary>
        bool IsAnimating { get; }
    }
}
