using PkmnLib.Dynamic.Models;
using PkmnLib.Static;

namespace PkmnLib.Dynamic.Events;

/// <summary>
/// Triggered when a Pokemon's stat boost is changed, either positively or negatively.
/// </summary>
public class StatBoostEvent : IEventData
{
    /// <inheritdoc cref="StatBoostEvent" />
    public StatBoostEvent(IPokemon pokemon, Statistic statistic, sbyte oldBoost, sbyte newBoost)
    {
        Pokemon = pokemon;
        Statistic = statistic;
        OldBoost = oldBoost;
        NewBoost = newBoost;
    }

    /// <summary>
    /// The Pokemon that had its stat boosted.
    /// </summary>
    public IPokemon Pokemon { get; }

    /// <summary>
    /// The statistic that was boosted.
    /// </summary>
    public Statistic Statistic { get; }

    /// <summary>
    /// The old boost value.
    /// </summary>
    public sbyte OldBoost { get; }

    /// <summary>
    /// The new boost value.
    /// </summary>
    public sbyte NewBoost { get; }

    /// <summary>
    /// The difference between the new and old boost values.
    /// </summary>
    public sbyte BoostDifference => (sbyte)(NewBoost - OldBoost);

    /// <inheritdoc />
    public EventBatchId BatchId { get; init; }
}