using System.Linq;
using Godot;

namespace Hellswipers.Game;

public record struct Gem {
    public readonly Texture2D Texture;
    public readonly string Name;
    public readonly Arrow.Dirs[] Dirs;
    
    public Gem(string Name, string textureName, Arrow.Dirs[] Dirs) {
        this.Name = Name;
        this.Dirs = Dirs;
        Texture = ResourceLoader.Load<Texture2D>(textureName);
    }

    public Variant this[int i] {
        get {
            switch (i) {
                case 0:
                    return Name;
                case 1:
                    return Texture;
                case 2:
                    return Dirs.Select(v => (int)v).ToArray();
            }
            return 0;
        }
    }

    public static Gem[] LoadGems() => new Gem[] {
        new ("LIFT-850 Jump Pack", "res://game/gems/LIFT-850icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Up,Arrow.Dirs.Down,Arrow.Dirs.Up}),
        new ("B-1 Supply Pack", "res://game/gems/B-1icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Up,Arrow.Dirs.Down}),
        new ("AX/LAS-5 \"Guard Dog\" Rover", "res://game/gems/AX-LAS-5icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Right}),
        new ("SH-20 Ballistic Shield Backpack", "res://game/gems/SH-20icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Left}),
        new ("SH-32 Shield Generator Pack", "res://game/gems/SH-32icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Right,Arrow.Dirs.Left,Arrow.Dirs.Right}),
        new ("AX/AR-23 \"Guard Dog\"", "res://game/gems/AX-AR-23icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Down}),
        new ("MG-43 Machine Gun", "res://game/gems/MG-43icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right}),
        new ("APW-1 Anti-Materiel Rifle", "res://game/gems/APW-1icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Right,Arrow.Dirs.Up,Arrow.Dirs.Down}),
        new ("M-105 Stalwart", "res://game/gems/M-105icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Up,Arrow.Dirs.Left}),
        new ("EAT-17 Expendable Anti-tank", "res://game/gems/EAT-17icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Up,Arrow.Dirs.Right}),
        new ("GR-8 Recoilless Rifle", "res://game/gems/GR-8icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Left}),
        new ("FLAM-40 Flamethrower", "res://game/gems/FLAM-40icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Up,Arrow.Dirs.Down,Arrow.Dirs.Up}),
        new ("AC-8 Autocannon", "res://game/gems/AC-8icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Up,Arrow.Dirs.Right}),
        new ("RS-422 Railgun", "res://game/gems/RS-422icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Right}),
        new ("FAF-14 SPEAR Launcher", "res://game/gems/FAF-14icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Down,Arrow.Dirs.Down}),
        new ("GL-21 Grenade Launcher", "res://game/gems/GL-21icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Down}),
        new ("LAS-98 Laser Cannon", "res://game/gems/LAS-98icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Left}),
        new ("ARC-3 Arc Thrower", "res://game/gems/ARC-3icon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Left}),
        new ("Reinforce", "res://game/gems/Reinforceicon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Down,Arrow.Dirs.Right,Arrow.Dirs.Left,Arrow.Dirs.Up}),
        new ("SOS Beacon", "res://game/gems/SOSicon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Down,Arrow.Dirs.Right,Arrow.Dirs.Up}),
        new ("Resupply", "res://game/gems/ResupplyIcon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right}),
        new ("NUX-223 Hellbomb", "res://game/gems/Strat_NUX-223_Hellbomb_mk1.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Up}),
        new ("SSSD Delivery", "res://game/gems/DeliverSSSDicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Up}),
        new ("Seismic Probe", "res://game/gems/Seismic_probe_icon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Down}),
        new ("Upload Data", "res://game/gems/DeliverSSSDicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Up,Arrow.Dirs.Up}),
        new ("Eagle Rearm", "res://game/gems/HD2_Eagle_Rearm_Icon.jpg", new [] {Arrow.Dirs.Up,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Up,Arrow.Dirs.Right}),
        new ("E/MG-101 HMG Emplacement", "res://game/gems/HMGTurreticon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Left}),
        new ("FX-12 Shield Generator Relay", "res://game/gems/Shieldrelayicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Right,Arrow.Dirs.Left,Arrow.Dirs.Right}),
        new ("A/ARC-3 Tesla Tower", "res://game/gems/Teslaicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Right}),
        new ("MD-6 Anti-Personnel Minefield", "res://game/gems/Minefieldicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Up,Arrow.Dirs.Right}),
        new ("MD-I4 Incendiary Mines", "res://game/gems/Fireminefieldicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Left,Arrow.Dirs.Down}),
        new ("A/MG-43 Machine Gun Sentry", "res://game/gems/MGsentryicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Up}),
        new ("A/G-16 Gatling Sentry", "res://game/gems/Gatlingsentryicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Left}),
        new ("A/M-12 Mortar Sentry", "res://game/gems/Mortarsentryicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Down}),
        new ("A/AC-8 Autocannon Sentry", "res://game/gems/Autocannoasentryicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Up}),
        new ("A/MLS-4X Rocket Sentry", "res://game/gems/Missilesentryicon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Left}),
        new ("A/M-23 EMS Mortar Sentry", "res://game/gems/EMSmortaricon.png", new [] {Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Right}),
        new ("Orbital Gatling Barrage", "res://game/gems/OrbitalGatlingicon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Up,Arrow.Dirs.Up}),
        new ("Orbital Airburst Strike", "res://game/gems/OrbitalAirbursticon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Right}),
        new ("Orbital 120MM HE Barrage", "res://game/gems/Orbital120icon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Left,Arrow.Dirs.Right,Arrow.Dirs.Down}),
        new ("Orbital 380MM HE Barrage", "res://game/gems/Orbital380icon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Up,Arrow.Dirs.Left,Arrow.Dirs.Down,Arrow.Dirs.Down}),
        new ("Orbital Walking Barrage", "res://game/gems/OrbitalWalkingicon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Right,Arrow.Dirs.Down}),
        new ("Orbital Laser", "res://game/gems/OrbitalLasericon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Down}),
        new ("Orbital Railcannon Strike", "res://game/gems/OrbitalRailcannonicon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Up,Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Right}),
        new ("Orbital Precision Strike", "res://game/gems/OrbitalPrecisionicon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Up}),
        new ("Orbital Gas Strike", "res://game/gems/OrbitalGasicon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Right}),
        new ("Orbital EMS Strike", "res://game/gems/OrbitalEMSicon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Left,Arrow.Dirs.Down}),
        new ("Orbital Smoke Strike", "res://game/gems/OrbitalSmokeicon.png", new [] {Arrow.Dirs.Right,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Up}),
        new ("Eagle Strafing Run", "res://game/gems/EagleStrafingicon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Right}),
        new ("Eagle Airstrike", "res://game/gems/EagleAirstrikeicon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Right}),
        new ("Eagle Cluster Bomb", "res://game/gems/EagleClusterbombicon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Right}),
        new ("Eagle Napalm Airstrike", "res://game/gems/EagleNapalmicon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Up}),
        new ("Eagle Smoke Strike", "res://game/gems/EagleSmokeicon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Up,Arrow.Dirs.Down}),
        new ("Eagle 110MM Rocket Pods", "res://game/gems/EagleRocketpodicon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Up,Arrow.Dirs.Left}),
        new ("Eagle 500kg Bomb", "res://game/gems/Eagle500icon.png", new [] {Arrow.Dirs.Up,Arrow.Dirs.Right,Arrow.Dirs.Down,Arrow.Dirs.Down,Arrow.Dirs.Down})
    };
}
