using GTANetworkAPI;
using ReallifeGamemode.Server.Entities;
using ReallifeGamemode.Server.Managers;
using ReallifeGamemode.Server.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReallifeGamemode.Server.Extensions
{
    public static class VehicleExtension
    {
        public static ServerVehicle GetServerVehicle(this Vehicle veh, DatabaseContext context = null)
        {
            return VehicleManager.GetServerVehicleFromVehicle(veh, context);
        }

        public static Client GetDriver(this Vehicle veh)
        {
            return NAPI.Pools.GetAllPlayers().Where(p => p.Vehicle.Handle == veh.Handle && p.VehicleSeat == -1).FirstOrDefault();
        }
    }
}
