#include "audit/zbxaudit.h"
#include "audit/zbxaudit_item.h"
void zbx_audit_item_update_json_add_data(zbx_uint64_t itemid, const zbx_template_item_t *item,
resource_type = zbx_audit_item_flag_to_resource_type(item->flags);
#define ADD_JSON_S(x, t, f) zbx_audit_update_json_append_string(itemid, AUDIT_ITEM_ID, AUDIT_DETAILS_ACTION_ADD,\
ZBX_AUDIT_IT_OR_ITP_OR_DR(x), item->x, t, f)
#define ADD_JSON_UI(x, t, f) zbx_audit_update_json_append_uint64(itemid, AUDIT_ITEM_ID, AUDIT_DETAILS_ACTION_ADD,\
ZBX_AUDIT_IT_OR_ITP_OR_DR(x), item->x, t, f)
#define AUDIT_TABLE_NAME "items"
zbx_audit_update_json_append_uint64(itemid, AUDIT_ITEM_ID, AUDIT_DETAILS_ACTION_ADD, ZBX_AUDIT_IT_OR_ITP_OR_DR(itemid),
itemid, AUDIT_TABLE_NAME, "itemid");
ADD_JSON_S(delay, AUDIT_TABLE_NAME, "delay");
zbx_audit_update_json_append_uint64(itemid, AUDIT_ITEM_ID, AUDIT_DETAILS_ACTION_ADD, ZBX_AUDIT_IT_OR_ITP_OR_DR(hostid),
hostid, AUDIT_TABLE_NAME, "hostid");
ADD_JSON_UI(interfaceid, AUDIT_TABLE_NAME, "interfaceid");
ADD_JSON_S(key, AUDIT_TABLE_NAME, "key_");
ADD_JSON_S(name, AUDIT_TABLE_NAME, "name");
ADD_JSON_UI(type, AUDIT_TABLE_NAME, "type");
ADD_JSON_S(url, AUDIT_TABLE_NAME, "url");
if (1 == zbx_audit_item_resource_is_only_item_prototype(resource_type))
zbx_audit_update_json_append_uint64(itemid, AUDIT_ITEM_ID, AUDIT_DETAILS_ACTION_ADD,
(1 == zbx_audit_item_resource_is_only_item(resource_type)) ? "item.value_type" :
"itemprototype.value_type", item->value_type, AUDIT_TABLE_NAME, "value_type");
ADD_JSON_UI(allow_traps, AUDIT_TABLE_NAME, "allow_traps");
ADD_JSON_UI(authtype, AUDIT_TABLE_NAME, "authtype");
ADD_JSON_S(description, AUDIT_TABLE_NAME, "description");
if (1 == zbx_audit_item_resource_is_only_item(resource_type))
zbx_audit_update_json_append_uint64(itemid, AUDIT_ITEM_ID, AUDIT_DETAILS_ACTION_ADD, "item.flags",