using GadgetCore.API;
using GadgetCore.API.ConfigMenu;
using ScrapYard.API;
using UnityEngine;

namespace MoreLights
{
  [Gadget("MoreLights", LoadAfter: new string[] { "ScrapYard" }, Dependencies: new string[] { "ScrapYard" })]
  public class MoreLights : Gadget<MoreLights>
  {
    public const string MOD_VERSION = "1.2"; // Set this to the version of your mod.
    public const string CONFIG_VERSION = "1.0"; // Increment this whenever you change your mod's config file.

    public override IGadgetConfigMenu GetConfigMenu() { return null; }

    public override string GetModDescription()
    {
      return "A mod that adds some more lights.";
    }

    protected override void Initialize()
    {
      Logger.Log("More Lights v" + Info.Mod.Version);
      Core.logger = Logger;

      Core.itemGreenLampId = ItemUtil.CreatePlacableLightItem("cGreenLamp.png", "iGreenLamp.png", "Green Light", new Color(0.1f, 0.6f, 0, 1));
      Core.itemYellowLampId = ItemUtil.CreatePlacableLightItem("cYellowLamp.png", "iYellowLamp.png", "Yellow Light", new Color(0.9f, 0.75f, 0, 1));
      Core.itemOrangeLampId = ItemUtil.CreatePlacableLightItem("cOrangeLamp.png", "iOrangeLamp.png", "Orange Light", new Color(0.7f, 0.15f, 0, 1));
      Core.itemPurpleLampId = ItemUtil.CreatePlacableLightItem("cPurpleLamp.png", "iPurpleLamp.png", "Purple Light", new Color(0.5f, 0, 0.6f, 1));
      Core.itemWhiteLampId = ItemUtil.CreatePlacableLightItem("cWhiteLamp.png", "iWhiteLamp.png", "White Light", new Color(0.8f, 0.8f, 0.8f, 1));

      foreach (var e in ShopPlatform.DefaultObjects.GetShopPlatformEntries())
      {
        if(e.ItemID == 2401 || e.ItemID == 2402)
        {
          ShopPlatform.DefaultObjects.RemoveShopPlatformEntry(e);
        }
      }

      var lightsPlatform = new ShopPlatform("Lights").Register();
      lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(Core.itemWhiteLampId, 1000));
      lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(Core.itemYellowLampId, 1000));
      lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(Core.itemOrangeLampId, 1000));
      lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(2402, 1000));
      lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(Core.itemPurpleLampId, 1000));
      lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(2401, 1000));
      lightsPlatform.AddShopPlatformEntry(new ShopPlatformEntry(Core.itemGreenLampId, 1000));

    }
  }
}
