#include "..\script_component.hpp"

/*
 * Function: forge_client_org_fnc_addAsset
 * Author: IDSolutions
 *
 * [Description]
 * Adds an asset to an organization's inventory.
 *
 * Arguments:
 * 0: Asset Type <STRING> - Type of asset (vehicle, building, etc.)
 * 1: Class Name <STRING> - Class name of the asset
 *
 * Return Value:
 * Asset ID <STRING> - Unique ID of the added asset, or nil if failed
 *
 * Example:
 * ["vehicle", "B_MRAP_01_F"] call forge_client_org_fnc_addAsset
 *
 * Public: Yes
 */

params [["_assetType", "", [""]], ["_className", "", [""]]];

// Validate input parameters
if (_assetType == "" || _className == "") exitWith { 
    ["Invalid parameters for adding asset", "error", 5, "right"] call forge_client_misc_fnc_notify;
    nil 
};

// Get the organization store interface
private _store = call FUNC(verifyOrgStore);

// Add the asset to the organization's inventory
// This will generate a unique ID and store all asset information
private _assetId = _store call ["addAsset", [_assetType, _className]];

// Provide feedback based on success or failure
if (_assetId != "") then {
    [format ["Asset added: %1 (%2)", _className, _assetType], "success", 5, "right"] call forge_client_misc_fnc_notify;
} else {
    ["Failed to add asset to organization", "error", 5, "right"] call forge_client_misc_fnc_notify;
};

// Return the asset ID for further operations
_assetId