DELIMITER $$
CREATE OR REPLACE DEFINER=`root`@`localhost` TRIGGER `vn`.`collectionVolumetry_afterDelete`
	AFTER DELETE ON `collectionVolumetry`
	FOR EACH ROW
BEGIN
	DECLARE vJSON JSON DEFAULT JSON_OBJECT();
	DECLARE vUserFk INT DEFAULT account.myUser_getId();

	SET vJSON = JSON_MERGE(JSON_OBJECT('id', OLD.id), vJSON);
	SET vJSON = JSON_MERGE(JSON_OBJECT('level', OLD.level), vJSON);
	SET vJSON = JSON_MERGE(JSON_OBJECT('lines', OLD.lines), vJSON);
	SET vJSON = JSON_MERGE(JSON_OBJECT('liters', OLD.liters), vJSON);
	SET vJSON = JSON_MERGE(JSON_OBJECT('height', OLD.height), vJSON);
	SET vJSON = JSON_MERGE(JSON_OBJECT('itemPackingTypeFk', OLD.itemPackingTypeFk), vJSON);
	SET vJSON = JSON_MERGE(JSON_OBJECT('trainFk', OLD.trainFk), vJSON);
	
	SET vJSON = JSON_MERGE(JSON_OBJECT('userFk', vUserFk), vJSON);
	SET vJSON = JSON_MERGE(JSON_OBJECT('action', 'delete'), vJSON);
	
	SET vJSON = util.notification_send(
		'modified-collection-volumetry',
		JSON_OBJECT('data', JSON_EXTRACT(vJSON, '$')),
		vUserFk
	);
END$$
DELIMITER ;