'use strict';
import { crudResultTypes } from '../../../../../fd-toolbox/types/crud/crud-result-type.js';
import { getCrudHandler } from '../resource-crud-handlers.js';
import { crudHandlerNames } from '../../constants/crud-handler-types.js';

var __defProp=Object['defineProperty'],__name=(_0x112141,_0x47c6fd)=>__defProp(_0x112141,'name',{'value':_0x47c6fd,'configurable':!![]});async function runPreDeleteHandler(_0x8e8a23,_0x635cf5,_0x40edac){const _0x45c1a2=await getCrudHandler(_0x8e8a23,crudHandlerNames['preDelete']);if(_0x45c1a2){const _0x43a57b={'crudServiceResult':_0x40edac,'deleteResource':_0x635cf5};await _0x45c1a2(_0x43a57b);}}__name(runPreDeleteHandler,'runPreDeleteHandler');async function runAfterDeleteHandler(_0x6b0120,_0x30c0a3,_0x367b6e){const _0x58597e=await getCrudHandler(_0x6b0120,crudHandlerNames['afterDelete']);if(_0x58597e){const _0x56f3c4={'crudServiceResult':_0x367b6e,'deleteResource':_0x30c0a3};await _0x58597e(_0x56f3c4);}}__name(runAfterDeleteHandler,'runAfterDeleteHandler');async function runPreUpdateHandler(_0x103871,_0x169d97,_0x1ee9f0,_0x5aa22c,_0x58cf47){const _0x493b4d=await getCrudHandler(_0x169d97['resourceName'],crudHandlerNames['preUpdate']);if(_0x493b4d){const _0x34d033={'crudServiceResult':_0x1ee9f0,'crudUpdateConfig':_0x103871,'modifiedResource':_0x5aa22c,'originalResource':_0x58cf47,'resourceMeta':_0x169d97};await _0x493b4d(_0x34d033);}}__name(runPreUpdateHandler,'runPreUpdateHandler');async function runAfterUpdateCrudHandler(_0x5b063e,_0x4234d5,_0x324bd0,_0x8d2a95,_0x3eccb4){const _0x3f35fa=await getCrudHandler(_0x4234d5['resourceName'],crudHandlerNames['afterUpdate']);_0x324bd0['result']=_0x8d2a95,_0x324bd0['type']=crudResultTypes['success'];if(_0x3f35fa){const _0x12982b={'crudServiceResult':_0x324bd0,'modifiedResource':_0x8d2a95,'crudUpdateConfig':_0x5b063e,'originalResource':_0x3eccb4};await _0x3f35fa(_0x12982b);}}__name(runAfterUpdateCrudHandler,'runAfterUpdateCrudHandler');async function runPreCreateHandler(_0x267f67,_0x4cb3d1,_0x5b6af6,_0x13c053){const _0x5b5991=await getCrudHandler(_0x4cb3d1['resourceName'],crudHandlerNames['preCreate']);if(_0x5b5991){const _0x580611={'crudServiceResult':_0x5b6af6,'crudUpdateConfig':_0x267f67,'createResource':_0x13c053,'resourceMeta':_0x4cb3d1};await _0x5b5991(_0x580611);}}__name(runPreCreateHandler,'runPreCreateHandler');async function runAfterCreateHandler(_0x3dc2fb,_0x18b756,_0x5db73b){const _0x1f6288=await getCrudHandler(_0x3dc2fb['resourceName'],crudHandlerNames['afterCreate']);if(_0x1f6288){const _0x33224d={'crudServiceResult':_0x18b756,'createdResource':_0x5db73b,'resourceMeta':_0x3dc2fb};await _0x1f6288(_0x33224d);}}__name(runAfterCreateHandler,'runAfterCreateHandler');

export { runAfterCreateHandler, runAfterDeleteHandler, runAfterUpdateCrudHandler, runPreCreateHandler, runPreDeleteHandler, runPreUpdateHandler };
