using GTANetworkAPI;
using Newtonsoft.Json;
using ReallifeGamemode.Database.Models;
using ReallifeGamemode.Server.Extensions;
using ReallifeGamemode.Server.Finance;
using ReallifeGamemode.Services;
using System;

/**
* @overview Life of German Reallife - Managers Interaction (InteractionManager.cs)
* @author MichaPlays
* @copyright (c) 2008 - 2021 Life of German
*/


namespace ReallifeGamemode.Server.newbie
{
  class Introduction : Script
  {
    private static TextLabel informationLabel;
    private static Marker marker;
    private static ColShape _colShape;
    public static Vector3 Position { get; }
    public static void Setup()
    {
      informationLabel = NAPI.TextLabel.CreateTextLabel("Einführung", new Vector3(-1025.57, -2732.15, 13.75), 20.0f, 1.3f, 0, new Color(255, 255, 255));
      marker = NAPI.Marker.CreateMarker(MarkerType.VerticalCylinder, new Vector3(-1025.57, -2732.15, 12.75), new Vector3(), new Vector3(), 2f, new Color(107, 0, 0));


      _colShape = NAPI.ColShape.CreateSphereColShape(new Vector3(-1025.57, -2732.15, 13.75), 2f);
      _colShape.OnEntityEnterColShape += EntityEnterBankColShape;
      _colShape.OnEntityExitColShape += EntityExitBankColShape;
    }
    private static void EntityEnterBankColShape(ColShape colShape, Player client)
    {
      if (client.IsInVehicle || !client.IsLoggedIn()) return;

      client.TriggerEvent("showIntroduction");
    }

    private static void EntityExitBankColShape(ColShape colShape, Player client)
    {
      client.TriggerEvent("removeIntroduction");
    }
  }
}
