using System;
using UnityEngine;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// Interface for submission holds.
    /// </summary>
    public interface ISubmissionHold : IWinningManeuver
    {
        /// <summary>
        /// Enumeration of submission hold types.
        /// </summary>
        public enum HoldType
        {
            /// A standing submission hold.
            Standing,

            /// A submission hold on the ground.
            Ground,
        }

        /// <summary>
        /// Sets the submission hold type that determines the type of attacks possible against the participants.
        /// </summary>
        HoldType Type { get; set; }

        /// <summary>
        /// Determines whether or not the victim can break out of this hold.
        /// Defaults to true.
        /// </summary>
        bool CanVictimBreakOut { get; set; }

        /// <summary>
        /// Sets up simple looping animations for the submission hold.
        /// </summary>
        /// <param name="instigatorLoop">the instigator base loop animation</param>
        /// <param name="victimLoop">the victim base loop animation</param>
        /// <returns>the respective playbacks</returns>
        ValueTuple<IAnimPlayback, IAnimPlayback> SetAnimations(AssetAddress instigatorLoop, AssetAddress victimLoop);

        /// <summary>
        /// Sets up animations for the submission hold.
        /// </summary>
        /// <param name="instigatorLoop">the instigator base loop animation</param>
        /// <param name="instigatorForward">the instigator forward movement animation</param>
        /// <param name="instigatorBackward">the instigator backward movement animation</param>
        /// <param name="instigatorMask">the avatar mask used for instigator movement</param>
        /// <param name="victimLoop">the victim base loop animation</param>
        /// <param name="victimForward">the victim forward movement animation</param>
        /// <param name="victimBackward">the victim backward movement animation</param>
        /// <param name="victimMask">the avatar mask used for victim movement</param>
        /// <param name="moveRefSpeed">the reference move speed of the movement animations</param>
        /// <returns></returns>
        ValueTuple<IAnimPlayback, IAnimPlayback> SetAnimations(
            AssetAddress instigatorLoop,
            AssetAddress instigatorForward,
            AssetAddress instigatorBackward,
            InlineArray<AvatarMaskBodyPart> instigatorMask,
            AssetAddress victimLoop,
            AssetAddress victimForward,
            AssetAddress victimBackward,
            InlineArray<AvatarMaskBodyPart> victimMask,
            float moveRefSpeed);

        /// <summary>
        /// Performs an action regularly while the hold is active.
        /// </summary>
        /// <param name="action">the action to perform</param>
        /// <param name="initialDelay">the delay before initially perfoming the action</param>
        /// <param name="interval">the regulra interval</param>
        void AddRegularAction(Action action, float initialDelay, float interval);
    }
}
