using System.Collections.Generic;

namespace Model.Hotkeys;

public class HotkeyModel
{
    public static readonly string[] KeyGroups = { "Z", "1", "2", "X", "CONTROL", "SHIFT", "C" };
    public static readonly string[] HotKeys = { "`", "Q", "W", "E", "R", "A", "S", "F", "X", "V", "CAPSLOCK", "TAB" };
    public string KeyText { get; set; }
    public KeyType KeyType { get; set; }
    public int PositionX { get; set; }
    public int PositionY { get; set; }
    public bool IsHidden { get; set; }

    public int Width { get; set; } = 1;

    public string GetColor()
    {
        return KeyType == KeyType.Action ? "#404146"
            : KeyType == KeyType.Cancel ? "#621b1b"
            : KeyType == KeyType.ControlGroup ? "#443512"
            : KeyType == KeyType.Army ? "#443512"
            : KeyType == KeyType.Train ? "#124443"
            : KeyType == KeyType.Research ? "#221244"
            : KeyType == KeyType.Construct ? "#122844"
            : KeyType == KeyType.Pyre ? "#441212"
            : KeyType == KeyType.Advance ? "#23262c"
            : KeyType == KeyType.Economy ? "#262c23"
            : "#37393F";
    }

    public static List<HotkeyModel> GetAll()
    {
        return new List<HotkeyModel>
        {
            new()
            {
                KeyText = "Z",
                KeyType = KeyType.Train,
                PositionX = 1,
                PositionY = 3
            },
            new()
            {
                KeyText = "D",
                KeyType = KeyType.Army,
                PositionX = 3,
                PositionY = 2
            },
            new()
            {
                KeyText = "C",
                KeyType = KeyType.Construct,
                PositionX = 3,
                PositionY = 3
            },
            new()
            {
                KeyText = "V",
                KeyType = KeyType.Pyre,
                PositionX = 4,
                PositionY = 3
            },
            new()
            {
                KeyText = "X",
                KeyType = KeyType.Research,
                PositionX = 2,
                PositionY = 3
            },
            new()
            {
                KeyText = "`",
                KeyType = KeyType.Cancel,
                PositionX = 0,
                PositionY = 0
            },

            new()
            {
                KeyText = "TAB",
                KeyType = KeyType.Action,
                PositionX = 0,
                PositionY = 1
            },

            new()
            {
                KeyText = "Q",
                KeyType = KeyType.Action,
                PositionX = 1,
                PositionY = 1
            },
            new()
            {
                KeyText = "W",
                KeyType = KeyType.Action,
                PositionX = 2,
                PositionY = 1
            },
            new()
            {
                KeyText = "E",
                KeyType = KeyType.Action,
                PositionX = 3,
                PositionY = 1
            },
            new()
            {
                KeyText = "R",
                KeyType = KeyType.Action,
                PositionX = 4,
                PositionY = 1
            },

            new()
            {
                KeyText = "CAPSLOCK",
                KeyType = KeyType.Action,
                PositionX = 0,
                PositionY = 2
            },

            new()
            {
                KeyText = "A",
                KeyType = KeyType.Action,
                PositionX = 1,
                PositionY = 2
            },
            new()
            {
                KeyText = "S",
                KeyType = KeyType.Action,
                PositionX = 2,
                PositionY = 2
            },
            new()
            {
                KeyText = "D",
                KeyType = KeyType.ControlGroup,
                PositionX = 3,
                PositionY = 2
            },

            new()
            {
                KeyText = "F",
                KeyType = KeyType.Action,
                PositionX = 4,
                PositionY = 2
            },
            new()
            {
                KeyText = "SPACE",
                KeyType = KeyType.Advance,
                PositionX = 1,
                PositionY = 4,
                Width = 4
            },
            // Economy
            new()
            {
                KeyText = "SHIFT", //TODO Update when game changes
                KeyType = KeyType.Economy,
                PositionX = 0,
                PositionY = 3
            },
            // Pyre
            new()
            {
                KeyText = "ALT",
                KeyType = KeyType.Economy,
                PositionX = 1,
                PositionY = 5,
                IsHidden = true
            },

            // Morphs
            new()
            {
                KeyText = "CONTROL",
                KeyType = KeyType.Economy,
                PositionX = 0,
                PositionY = 4
            }
        };
    }
}