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

namespace FSI.Lib.Guis.WebRadio.Player
{
    public static class AvailableActions
    {
        public enum PlayerAction
        {
            None,
            Quit,
            Add,
            VolumeDown,
            VolumeUp,
            Next,
            Previous,
            Pause,
            Delete
        }

        public static Dictionary<PlayerAction, string> Correspondence = new Dictionary<PlayerAction, string>()
        {
            {PlayerAction.Quit, "q" },
            {PlayerAction.Add, "a" },
            {PlayerAction.VolumeDown, "-" },
            {PlayerAction.VolumeUp, "+" },
            {PlayerAction.Next, "n" },
            {PlayerAction.Previous, "p" },
            {PlayerAction.Pause, "space" },
            {PlayerAction.Delete, "d" },
        };

        public static PlayerAction ToPlayerAction(this ConsoleKeyInfo info)
        {
            switch (info.KeyChar)
            {
                case ' ':
                    return PlayerAction.Pause;
                default:
                    break;
            }
            return Correspondence.FirstOrDefault(s => s.Value[0] == info.KeyChar).Key;
        }



    }
}
