using System.Timers;
using ReallifeGamemode.Server.Finance;
using ReallifeGamemode.Server.Job;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Wanted;
using ReallifeGamemode.Server.WeaponDeal;

namespace ReallifeGamemode.Server.Util
{
  public class ThreadTimers
  {
    private static Timer timer500 = new Timer(500); //0.5 seconds timer
    private static Timer timer2500 = new Timer(2500); //2.5 seconds timer
    private static Timer timer10000 = new Timer(10000); // 10 second timer
    private static Timer timer60000 = new Timer(60000); //60 seconds timer

    public static void StartAllTimers()
    {
      timer500.Start();
      timer500.Elapsed += Timer500_Elapsed;

      timer2500.Start();
      timer2500.Elapsed += Timer2500_Elapsed;

      timer10000.Start();
      timer10000.Elapsed += Timer10000_Elapsed;

      timer60000.Start();
      timer60000.Elapsed += Timer60000_Elapsed;
    }

    private static void Timer500_Elapsed(object sender, ElapsedEventArgs e)
    {
      TaxiDriverJob.UpdateFare();
      VehicleManager.VehicleTimerTick();
    }

    private static void Timer60000_Elapsed(object sender, ElapsedEventArgs e)
    {
      Jail.JailOut_Elapsed();
      Economy.Timer_Elapsed();
      WeaponDealManager.Timer_Elapsed();
    }

    private static void Timer10000_Elapsed(object sender, ElapsedEventArgs e)
    {
      Jail.BrakeOut_Elapsed();
    }

    private static void Timer2500_Elapsed(object sender, ElapsedEventArgs e)
    {
      WantedEscapeTimer.Timer_Elapsed();
      Jail.JailIn_Elapsed();
      Gangwar.Gangwar.Value_TimerElapsed();
    }
  }
}
