using System;
using System.Collections.Generic;
using System.Text;
using GTANetworkAPI;
using ReallifeGamemode.Server.Core.API;
using ReallifeGamemode.Server.Types;

namespace ReallifeGamemode.Server.Core.RageMP
{
  public static class RageExtensions
  {
    public static Vector3 ToVector3(this Position position)
    {
      return new Vector3(position.X, position.Y, position.Z);
    }

    public static Position ToPosition(this Vector3 vector)
    {
      return new Position(vector.X, vector.Y, vector.Z);
    }

    public static DisconnectReason ToDisconnectReason(this DisconnectionType disconnectionType)
    {
      switch (disconnectionType)
      {
        case DisconnectionType.Left:
          return DisconnectReason.Quit;

        case DisconnectionType.Kicked:
          return DisconnectReason.Kick;

        case DisconnectionType.Timeout:
          return DisconnectReason.Timeout;
        default:
          return DisconnectReason.Unknown;
      }
    }

    public static GTANetworkAPI.Color ToColor(this API.Color color)
    {
      return new GTANetworkAPI.Color(color.R, color.G, color.B);
    }
  }
}
