using System;
using UnityEngine;

namespace pdinklag.CPW.Common
{
    /// <summary>
    /// A moveset entry of two moves from which the player can choose
    /// by tapping or holding a button.
    /// </summary>
    [Serializable]
    public class ButtonInteractionMovesetEntry : MovesetEntry<ButtonInteractionMovesetEntry>
    {
        [Tooltip("The move chosen if the button is tapped.")]
        public AssetAddress Tap;

        [Tooltip("The move chosen if the button is held for a short while.")]
        public AssetAddress Hold;

        public override AssetAddress[] Moves => new AssetAddress[] { Tap, Hold };

        public ButtonInteractionMovesetEntry()
        {
        }

        public ButtonInteractionMovesetEntry(ButtonInteractionMovesetEntry other)
        {
            Tap = other.Tap;
            Hold = other.Hold;
        }

        public override void Merge(ButtonInteractionMovesetEntry other)
        {
            Tap = OverrideIfValid(Tap, other.Tap);
            Hold = OverrideIfValid(Hold, other.Hold);
        }
    }
}
