using System;
using System.Collections.Generic;
using System.Linq;

namespace FishDice.LuckyDice
{
    public sealed class RollFlowResult
    {
        public RollFlowResult(
            string rollSessionId,
            DiceRollResult rollResult,
            ComboFacts comboFacts,
            IReadOnlyList<ComboRuleMatch> matchedRules,
            IReadOnlyList<RollActionResult> actionResults,
            IReadOnlyList<RollEffect> effects,
            LuckyDiceSelectionResult luckyDiceResult,
            TargetModeEntry targetMode,
            RollTrace trace)
        {
            RollSessionId = rollSessionId;
            RollResult = rollResult;
            ComboFacts = comboFacts;
            MatchedRules = matchedRules == null ? Array.Empty<ComboRuleMatch>() : matchedRules.ToArray();
            ActionResults = actionResults == null ? Array.Empty<RollActionResult>() : actionResults.ToArray();
            Effects = effects == null ? Array.Empty<RollEffect>() : effects.ToArray();
            LuckyDiceResult = luckyDiceResult;
            TargetMode = targetMode;
            Trace = trace;
        }

        public string RollSessionId { get; }

        public DiceRollResult RollResult { get; }

        public ComboFacts ComboFacts { get; }

        public IReadOnlyList<ComboRuleMatch> MatchedRules { get; }

        public IReadOnlyList<RollActionResult> ActionResults { get; }

        public IReadOnlyList<RollEffect> Effects { get; }

        public LuckyDiceSelectionResult LuckyDiceResult { get; }

        public TargetModeEntry TargetMode { get; }

        public RollTrace Trace { get; }
    }
}
