#ifndef TRWEAPONS_H
#define TRWEAPONS_H

#include <trng_core.h>

#define DATASCRIPT_PATH "data/scripts"
#define DATASCRIPT_WEAPON_PATH "data/scripts/weapons"
#define UNARMED_PATH "data/scripts/weapons/unarmed.json"
#define PISTOLS_PATH "data/scripts/weapons/pistols.json"
#define UZIS_PATH "data/scripts/weapons/uzis.json"
#define MAGNUM_PATH "data/scripts/weapons/magnum.json"
#define AUTOPISTOLS_PATH "data/scripts/weapons/autopistols.json"
#define SHOTGUN_PATH "data/scripts/weapons/shotgun.json"
#define REVOLVER_PATH "data/scripts/weapons/revolver.json"
#define DESERTEAGLE_PATH "data/scripts/weapons/desert_eagle.json"
#define M16_PATH "data/scripts/weapons/m16.json"
#define MP5_PATH "data/scripts/weapons/mp5.json"
#define GRENADEGUN_PATH "data/scripts/weapons/grenade_gun.json"
#define CROSSBOW_PATH "data/scripts/weapons/crossbow.json"
#define ROCKETGUN_PATH "data/scripts/weapons/rocket_gun.json"
#define HARPOON_PATH "data/scripts/weapons/harpoon.json"
#define FLARE_PATH "data/scripts/weapons/flare.json"
#define SNOWMOBILE_PATH "data/scripts/weapons/snowmobile.json"

class TRWeapons
{
private:
    WEAPON_INFO* unarmed;
    WEAPON_INFO* pistols;
    WEAPON_INFO* uzis;
    WEAPON_INFO* magnum;
    WEAPON_INFO* autopistols;
    WEAPON_INFO* shotgun;
    WEAPON_INFO* revolver;
    WEAPON_INFO* desert_eagle;
    WEAPON_INFO* m16;
    WEAPON_INFO* mp5;
    WEAPON_INFO* grenade_gun;
    WEAPON_INFO* crossbow;
    WEAPON_INFO* rocket_gun;
    WEAPON_INFO* harpoon;
    WEAPON_INFO* flare;
    WEAPON_INFO* snowmobile;
    
    /// assign malloc to weapons.
    void malloc_weapons();

    /// load json and assign the value in "WEAPON_INFO*"
    void load_weapons(LPCSTR file_name, WEAPON_INFO* winfo);

    /// create all weapons files
    void create_unarmed();
    void create_pistols();
    void create_uzis();
    void create_magnum();
    void create_autopistols();
    void create_shotgun();
    void create_revolver();
    void create_desert_eagle();
    void create_m16();
    void create_mp5();
    void create_grenade_gun();
    void create_crossbow();
    void create_rocket_gun();
    void create_harpoon();
    void create_flare();
    void create_snowmobile();

public:
    // create folder and files if not exists !
    void create_weapons();
    // load the files and assign the value in private structure !
    void initialise_weapons();

    /// get the weapon value with these function:
    WEAPON_INFO* get_unarmed();
    WEAPON_INFO* get_pistols();
    WEAPON_INFO* get_uzis();
    WEAPON_INFO* get_revolver();
    WEAPON_INFO* get_magnums();
    WEAPON_INFO* get_autopistols();
    WEAPON_INFO* get_shotgun();
    WEAPON_INFO* get_desert_eagle();
    WEAPON_INFO* get_m16();
    WEAPON_INFO* get_mp5();
    WEAPON_INFO* get_grenade();
    WEAPON_INFO* get_crossbow();
    WEAPON_INFO* get_rocket();
    WEAPON_INFO* get_harpoon();
    WEAPON_INFO* get_flare();
    WEAPON_INFO* get_snowmobile();
    // only weapon flag !!! (snowmobile included !)
    WEAPON_INFO* get_weapons(LARA_HOLD hold_type);

    // free all weapons (free memory space from malloc command)
    void free_weapons();
};

extern TRWeapons weapons;

#endif
