using System.Collections.Generic;
using GTANetworkAPI;
using ReallifeGamemode.Server.Shop.Clothing;
using ReallifeGamemode.Server.Shop.SevenEleven;

namespace ReallifeGamemode.Server.Managers
{
  public class PositionManager : Script
  {
    public static List<DutyPoint> DutyPoints = new List<DutyPoint>();

    public static List<WeaponPoint> WeaponPoints = new List<WeaponPoint>();

    public static List<JailReleasePoint> JailReleasePoints = new List<JailReleasePoint>();

    public static List<ElevatorPoint> ElevatorPoints = new List<ElevatorPoint>();

    public static List<ClotheshopPoint> clotheshopPoints = new List<ClotheshopPoint>();

    public static List<ItemshopPoint> itemshopPoints = new List<ItemshopPoint>();

    [ServerEvent(Event.ResourceStart)]
    public void OnResourceStart()
    {
      #region DutyPoints

      DutyPoint dutyPointLSPD = new DutyPoint()
      {
        Position = new Vector3(458.24, -990.86, 30.68),
        FactionId = 1
      };
      DutyPoint dutyPointFIB = new DutyPoint()
      {
        Position = new Vector3(109.5706, -745.2126, 242.1521),
        FactionId = 3
      };
      DutyPoint dutyPointLSED = new DutyPoint()
      {
        Position = new Vector3(1152.181, -1527.95, 34.8434),
        FactionId = 2
      };

      DutyPoints.Add(dutyPointLSPD);
      DutyPoints.Add(dutyPointFIB);
      DutyPoints.Add(dutyPointLSED);

      foreach (DutyPoint d in DutyPoints)
      {
        NAPI.Marker.CreateMarker(1, new Vector3(d.Position.X, d.Position.Y, d.Position.Z - 2), new Vector3(d.Position.X, d.Position.Y, d.Position.Z + 1),
            new Vector3(0, 0, 0), 3, new Color(255, 255, 255, 50), false, 0);
        NAPI.TextLabel.CreateTextLabel("Stempeluhr - Dr\u00fccke ~y~E\n~s~Dienstkleidung - Dr\u00fccke ~y~K", d.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
      }

      #endregion DutyPoints

      #region WeaponPoints

      WeaponPoint weaponPointLSPD = new WeaponPoint()
      {
        Position = new Vector3(460.3162, -981.0168, 30.68959),
        FactionId = 1
      };
      WeaponPoint weaponPointFIB = new WeaponPoint()
      {
        //Position = new Vector3(119.6835, -729.3273, 242.1519), old
        Position = new Vector3(143.5561, -762.7424, 242.152),
        FactionId = 3
      };
      WeaponPoint weaponPointBallas = new WeaponPoint()
      {
        Position = new Vector3(1217.748, -1639.349, 47.77029),
        FactionId = 8
      };
      WeaponPoint weaponPointGrove = new WeaponPoint()
      {
        Position = new Vector3(129.8998, -1938.709, 20.61865),
        FactionId = 7
      };

      WeaponPoints.Add(weaponPointLSPD);
      WeaponPoints.Add(weaponPointFIB);
      WeaponPoints.Add(weaponPointBallas);
      WeaponPoints.Add(weaponPointGrove);

      foreach (WeaponPoint w in WeaponPoints)
      {
        NAPI.Marker.CreateMarker(1, new Vector3(w.Position.X, w.Position.Y, w.Position.Z - 2), new Vector3(w.Position.X, w.Position.Y, w.Position.Z + 1),
           new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
        NAPI.TextLabel.CreateTextLabel("Waffenspind - Dr\u00fccke ~y~E", w.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
      }

      #endregion WeaponPoints

      #region JailReleasePoints

      JailReleasePoint jailPointLSPD = new JailReleasePoint()
      {
        Position = new Vector3(459.5327, -988.8435, 24.91487)
      };
      JailReleasePoint jailPointFIB = new JailReleasePoint()
      {
        Position = new Vector3(119.6362, -727.6199, 242.152)
      };

      JailReleasePoints.Add(jailPointLSPD);
      JailReleasePoints.Add(jailPointFIB);

      foreach (JailReleasePoint j in JailReleasePoints)
      {
        NAPI.Marker.CreateMarker(1, new Vector3(j.Position.X, j.Position.Y, j.Position.Z - 2), new Vector3(j.Position.X, j.Position.Y, j.Position.Z + 1),
           new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
        NAPI.TextLabel.CreateTextLabel("Gefängnis PC - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
      }

      #endregion JailReleasePoints

      #region ElevetaorPoints

      ElevatorPoint FibElevatorPointEG = new ElevatorPoint()
      {
        Position = new Vector3(136.1958, -761.657, 242.152), //FBI oben
        FactionId = 3,
        Stage = "Büro"
      };
      ElevatorPoint FibElevatorPointIntern = new ElevatorPoint()
      {
        Position = new Vector3(136.1958, -761.7176, 45.75203), //FBI unten
        FactionId = 3,
        Stage = "EG"
      };
      ElevatorPoint FibElevatorPointGarage = new ElevatorPoint()
      {
        Position = new Vector3(124.2521, -741.3329, 33.13322), //FBI ganz ganz unten
        FactionId = 3,
        Stage = "Garage"
      };

      ElevatorPoints.Add(FibElevatorPointEG);
      ElevatorPoints.Add(FibElevatorPointIntern);
      ElevatorPoints.Add(FibElevatorPointGarage);

      foreach (ElevatorPoint j in ElevatorPoints)
      {
        NAPI.Marker.CreateMarker(1, new Vector3(j.Position.X, j.Position.Y, j.Position.Z - 2), new Vector3(j.Position.X, j.Position.Y, j.Position.Z + 1),
           new Vector3(0, 0, 0), 1.5f, new Color(255, 255, 255, 50), false, 0);
        NAPI.TextLabel.CreateTextLabel("Aufzug - Dr\u00fccke ~y~E", j.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
      }

      #endregion ElevetaorPoints

      #region Shops
      foreach (var shop in ShopManager.clotheStores)
      {
        shop.LoadClothes();
        ClotheshopPoint shopPoint = new ClotheshopPoint()
        {
          Position = shop.vector,
          clotheShop = shop
        };
        clotheshopPoints.Add(shopPoint);
      }

      foreach(ClotheshopPoint s in clotheshopPoints) 
      {
        NAPI.Marker.CreateMarker(1, new Vector3(s.Position.X, s.Position.Y, s.Position.Z - 2), new Vector3(s.Position.X, s.Position.Y, s.Position.Z + 1),
           new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
        NAPI.TextLabel.CreateTextLabel("Kleiderladen - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
      }


      foreach(var shop in ShopManager.itemShops)
      {
        shop.LoadItems();
        ItemshopPoint shopPoint = new ItemshopPoint()
        {
          Position = shop.vector3,
          itemShop = shop
        };
        itemshopPoints.Add(shopPoint);
      }

      foreach(ItemshopPoint s in itemshopPoints)
      {
        NAPI.Marker.CreateMarker(1, new Vector3(s.Position.X, s.Position.Y, s.Position.Z - 2), new Vector3(s.Position.X, s.Position.Y, s.Position.Z + 1),
           new Vector3(0, 0, 0), 2, new Color(255, 255, 255, 50), false, 0);
        NAPI.TextLabel.CreateTextLabel("24/7 - Dr\u00fccke ~y~E", s.Position, 7, 1, 0, new Color(255, 255, 255), false, 0);
      }

      #endregion Shops
    }


  }
}

public class DutyPoint
{
  public Vector3 Position { get; set; }
  public int FactionId { get; set; }
}

public class WeaponPoint
{
  public Vector3 Position { get; set; }
  public int FactionId { get; set; }
}

public class JailReleasePoint
{
  public Vector3 Position { get; set; }
}

public class ClotheshopPoint
{
  public Vector3 Position { get; set; }
  public ClotheShop clotheShop { get; set; }

}

public class ItemshopPoint
{
  public Vector3 Position { get; set; }
  public ItemShop itemShop { get; set; }

}

public class ElevatorPoint
{
  public Vector3 Position { get; set; }
  public int FactionId { get; set; }
  public string Stage { get; set; }
}
 
