#include "..\script_component.hpp"

/*
 * Function: forge_client_org_fnc_listPlayerInvites
 * Author: J. Schmidt
 * 
 * Description:
 * Lists all organization invites for the current player
 *
 * Arguments:
 * 0: _playerUID - Player UID <STRING>
 *
 * Return Value:
 * Array of organization invites <ARRAY>
 */

params [["_playerUID", "", [""]]];

if (_playerUID == "") exitWith { TRACE_1("Invalid player UID",_playerUID); [] };

private _playerInvites = GETVAR(profileNamespace,FORGE_ORG_INVITES,createHashMap);
private _invitesList = [];

{
    private _inviteKey = _x;
    private _invite = _playerInvites get _inviteKey;

    _invitesList pushBack [
        _inviteKey,
        _invite get "orgName",
        _invite get "ownerUID",
        _invite get "timestamp"
    ];
} forEach (keys _playerInvites);

_invitesList