﻿using System;

namespace Yumon.Template.Lite.Internal
{
    public enum League { Practice, Common, Limited, Epic }

    public static class YumonLeagueManager
    {
        static readonly int LeagueCount = Enum.GetNames(typeof(League)).Length;

        /// <summary>
        ///     The current league. Use it in your logic to customize the look and feel of your game.
        /// </summary>
        public static League CurrentLeague { get; private set; } = League.Practice;
        /// <summary>
        ///     Event that is fired when the league changes. Subscribe to it to update your game's look and feel based on the
        ///     league.
        /// </summary>
        public static event Action<League> OnLeagueChanged;

        internal static void NextLeague()
        {
            CurrentLeague = (League)(((int)CurrentLeague + 1) % LeagueCount);
            OnLeagueChanged?.Invoke(CurrentLeague);
        }

        internal static void PreviousLeague()
        {
            CurrentLeague = (League)(((int)CurrentLeague + LeagueCount - 1) % LeagueCount);
            OnLeagueChanged?.Invoke(CurrentLeague);
        }
    }
}
