using System;
using YachtDice.Economy;
using YachtDice.Inventory;

namespace YachtDice.Player
{
    public class PlayerModel
    {
        public CurrencyBank Currency { get; }
        public InventoryModel Inventory { get; }
        public DiceCollection Dice { get; }

        public event Action OnChanged;

        public PlayerModel(
            CurrencyBank currencyBank,
            InventoryModel inventory,
            DiceCollection diceCollection)
        {
            Currency = currencyBank;
            Inventory = inventory;
            Dice = diceCollection;

            currencyBank.OnBalanceChanged += _ => OnChanged?.Invoke();
            inventory.OnInventoryChanged += () => OnChanged?.Invoke();
            diceCollection.OnChanged += () => OnChanged?.Invoke();
        }
    }
}
