'use strict';
import { statusBoardId, statusBoardConstants } from './status-board-constants.js';
import { apiGet, apiPost } from '../../../fd-toolbox/api/api-client.js';
import { apiPathNames } from '../../../fd-toolbox/api/api-path-names.js';

var __defProp=Object['defineProperty'],__name=(_0x15e9ab,_0x59a467)=>__defProp(_0x15e9ab,'name',{'value':_0x59a467,'configurable':!![]});async function onDragEnd(_0x40cd3a,_0x41b7fb){const _0x314db4=_0x41b7fb['statusBoardData']['find'](_0xe7c06a=>_0xe7c06a['statusBoardItemList']?.['some'](_0x3dacf1=>_0x3dacf1['id']===_0x40cd3a['active']['id'])),_0x554ad6=_0x41b7fb['statusBoardData']['find'](_0x3e2f57=>_0x3e2f57['id']===_0x40cd3a['over']?.['id']);if(!_0x314db4||!_0x554ad6||_0x314db4===_0x554ad6)return;_0x314db4['statusBoardItemList']??=[],_0x554ad6['statusBoardItemList']??=[];let _0x584e6a;const _0x482168=[];for(const _0x149f0c of _0x314db4['statusBoardItemList']){_0x149f0c['id']===_0x40cd3a['active']['id']?_0x584e6a=_0x149f0c:_0x482168['push'](_0x149f0c);}_0x314db4['statusBoardItemList']=_0x482168;if(_0x584e6a){_0x554ad6['statusBoardItemList']['push'](_0x584e6a);const _0x1f6258=Array['from'](_0x41b7fb['statusBoardData']);_0x41b7fb['setStatusBoardData'](_0x1f6258),await updateStatusParent(_0x584e6a['id'],_0x554ad6['id']);}}__name(onDragEnd,'onDragEnd');async function fetchStatusBoardData(){const _0x1ba960=[{'name':statusBoardConstants['getBoardData'],'value':statusBoardId['borderId']}];return (await apiGet(apiPathNames['statusBoard'],void(-0x1524+0x3d*-0x89+0x35c9),_0x1ba960))['data'];}__name(fetchStatusBoardData,'fetchStatusBoardData');async function onInit(_0x4490f5){const _0x2cf71c=await fetchStatusBoardData();if(_0x2cf71c)_0x4490f5(_0x2cf71c['statusBoardStatusList']);}__name(onInit,'onInit');async function updateStatusParent(_0x41a7cf,_0x143628){const _0x1f59a2={'statusBoardItemId':_0x41a7cf,'newParentId':_0x143628};await apiPost(apiPathNames['statusBoard'],_0x1f59a2);}__name(updateStatusParent,'updateStatusParent');

export { fetchStatusBoardData, onDragEnd, onInit };
