/// <reference path="../../node_modules/@citizenfx/server/index.d.ts" />
/// <reference path="../../node_modules/@citizenfx/server/natives_server.d.ts" />

// FiveM globals not included in the @citizenfx/server package typings
declare function RegisterNetEvent(eventName: string, cb?: Function): void;
declare function RegisterCommand(commandName: string, handler: (source: number, args: string[], rawCommand: string) => void, restricted: boolean): void;
declare function GetPlayerIdentifierByType(playerSrc: string, identifierType: string): string;
declare function GetPlayerIdentifier(playerSrc: string, identiferIndex: number): string;
declare function GetNumPlayerIdentifiers(playerSrc: string): number;
declare function GetPlayerEndpoint(playerSrc: string): string;
declare function GetPlayerName(playerSrc: string): string;
declare function GetPlayerPed(playerSrc: string): number;
declare function DropPlayer(playerSrc: string, reason: string): void;
declare function GetPedInVehicleSeat(vehicle: number, seat: number): number;
declare function GetVehiclePedIsIn(ped: number, lastVehicle: boolean): number;
declare function GetEntityCoords(entity: number): [number, number, number];
declare function GetEntityModel(entity: number): number;
declare function GetEntityHeading(entity: number): number;
declare function SetEntityHeading(entity: number, heading: number): void;
declare function SetEntityCoords(entity: number, x: number, y: number, z: number, alive: boolean, deadFlag: boolean, ragdollFlag: boolean, clearArea: boolean): void;
declare function SetEntityHealth(entity: number, health: number): void;
declare function GetEntityHealth(entity: number): number;
declare function DeleteEntity(entity: number): void;
declare function NetworkGetNetworkIdFromEntity(entity: number): number;
declare function NetworkGetEntityFromNetworkId(netId: number): number;
declare function CreateVehicle(modelHash: number, x: number, y: number, z: number, heading: number, isNetwork: boolean, netMissionEntity: boolean): number;
declare function SetVehicleNumberPlateText(vehicle: number, plateText: string): void;
declare function GetVehicleNumberPlateText(vehicle: number): string;
declare function SetVehicleColours(vehicle: number, primaryColour: number, secondaryColour: number): void;
declare function GetConvar(varName: string, default_: string): string;
declare function GetConvarInt(varName: string, default_: number): number;
declare function SetConvar(varName: string, value: string): void;
declare function TriggerEvent(eventName: string, ...args: any[]): void;
declare function GetHashKey(key: string): number;

// Player state bags
declare function Player(playerSrc: number): { state: Record<string, any> & { set(key: string, value: any, replicated: boolean): void } };

// source global (active player in event handlers)
declare const source: number;

// Resource path helpers
declare function GetCurrentResourceName(): string;
declare function GetResourcePath(resourceName: string): string;
