using System;
using System.Collections.Generic;
using UnityEngine;
using YachtDice.Categories;
using YachtDice.Dice;

namespace YachtDice.Scoring
{
    [Serializable]
    public struct ScoreResult
    {
        public int BaseScore;
        public int FlatBonus;
        public float Multiplier;
        public int[] DiceValues;
        public CategoryDefinition Category;

        public int FinalScore => Mathf.FloorToInt((BaseScore + FlatBonus) * Multiplier);

        public static ScoreResult Create(int baseScore, IReadOnlyList<IDie> dice, CategoryDefinition category)
        {
            return new ScoreResult
            {
                BaseScore = baseScore,
                FlatBonus = 0,
                Multiplier = 1f,
                DiceValues = DiceCheckUtility.ExtractValues(dice),
                Category = category
            };
        }
    }
}
