import{MESApiService as e,axiosInstance as t,getMomentTz as n}from"./index-CA65pJ_5.js";import{camelcaseKeys as r}from"./camelcase-keys-BOJx-vJX.js";let i=function(e){return e[e.DryOutComplete=201]=`DryOutComplete`,e[e.DryOutSlagline=202]=`DryOutSlagline`,e[e.test=203]=`test`,e[e.InService=204]=`InService`,e[e.InTransit=205]=`InTransit`,e[e.Next=206]=`Next`,e[e.OOSComplete=207]=`OOSComplete`,e[e.OOSCompleteComplete=208]=`OOSCompleteComplete`,e[e.OOSDrain=209]=`OOSDrain`,e[e.OOSOther=210]=`OOSOther`,e[e.OOSSlagLine=211]=`OOSSlagLine`,e[e.OutOfService=212]=`OutOfService`,e[e.Standby=213]=`Standby`,e[e.TOutOfService=301]=`TOutOfService`,e[e.TInService=302]=`TInService`,e[e.TReturnedFromVendor=303]=`TReturnedFromVendor`,e}({});const a={[i.TInService]:[i.TInService,i.TOutOfService],[i.TOutOfService]:[i.TOutOfService,i.TReturnedFromVendor],[i.TReturnedFromVendor]:[i.TReturnedFromVendor,i.TInService]},o=n();var s=class{getAxiosInstance(){return t}async getSpecialComponents(e={}){let t=await this.getAxiosInstance().get(`/special-components`,{params:e}),n=t.data.map(e=>({...e,part:{...e.part,arrivalDate:e.part.arrivalDate?o.utc(e.part.arrivalDate).toDate():null,departureDate:e.part.departureDate?o.utc(e.part.departureDate).toDate():null,estimatedArrivalDate:e.part.estimatedArrivalDate?o.utc(e.part.estimatedArrivalDate).toDate():null,refurbishRequiredDate:e.part.refurbishRequiredDate?o.utc(e.part.refurbishRequiredDate).toDate():null},lastTask:e.lastTask?{...e.lastTask,performTime:e.lastTask.performTime?o.utc(e.lastTask.performTime).toDate():null}:null}));return{error:!1,data:n}}async takeLidsOutOfService({partsIds:e,comments:t,workers:n}){let r=await this.getAxiosInstance().patchForm(`/special-components/multiple/oos`,{partsIds:e.join(`,`),comments:t,workers:n});return{ok:!0,data:r.data}}async sendToRefurbish(e){let t=await this.getAxiosInstance().patchForm(`/special-components/${e.partId}`,e);return{ok:!0,data:t.data}}async getPermanentLiningTundishes(){let e=await this.getAxiosInstance().get(`/special-components/permanent-lining`);if(e.data.success){let t=e.data;return t.result=t.result.map(e=>({...e,tundishFinalSince:e.tundishFinalSince?o.utc(e.tundishFinalSince).toDate():null,readyForUseSince:e.readyForUseSince?o.utc(e.readyForUseSince).toDate():null,aimDeskullTime:e.aimDeskullTime?o.utc(e.aimDeskullTime).toDate():null,metrics:e.metrics?r(JSON.parse(e.metrics)):null,lastRefurbishment:e.lastRefurbishment?r(JSON.parse(e.lastRefurbishment)):null,lastTask:e.lastTask?{...r(JSON.parse(e.lastTask),{deep:!0}),performTime:JSON.parse(e.lastTask).PerformTime?o.utc(JSON.parse(e.lastTask).PerformTime).toDate():null}:null})),{ok:!0,data:t.result}}return{ok:!1,data:e.data.result}}async getPermanentLiningByTundishId(e){let t=await this.getAxiosInstance().get(`/special-components/permanent-lining/${e}`);if(t.data.success){let e=t.data.result,n={departureDate:e.departureDate?o.utc(e.departureDate).toDate():null,refurbishVendorId:e.refurbishVendorId||null,refurbishRequiredDate:e.refurbishRequiredDate?o.utc(e.refurbishRequiredDate).toDate():null,refurbishRequiredByWorkerId:e.refurbishRequiredByWorkerId||null,estimatedArrivalDate:e.estimatedArrivalDate?o.utc(e.estimatedArrivalDate).toDate():null,arrivalDate:e.arrivalDate?o.utc(e.arrivalDate).toDate():null,comments:e.comments||``};return{ok:!0,data:n}}return{ok:!1,data:t.data.result}}async updatePermanentLiningRefurbishment(e,t){let n=await this.getAxiosInstance().patchForm(`/special-components/permanent-lining/${e}`,t);return{ok:n.data.success,data:n.data}}async changePermanentLining(e,t){let n=await this.getAxiosInstance().postForm(`/special-components/permanent-lining/${e}/install`,t);return{ok:n.data.success,data:n.data}}async getTundishPLHistory(t){let n=new e;return await n.callV2(`REF.GetTundishHistory`,[{name:`TundishId`,value:t}])}};const c=new s,l=e=>e?.arrivalDate?`Received`:e?.departureDate?`In Transit`:e?.refurbishRequiredDate?`Pending Shipment`:`Out of Service`;export{i as RootStateEnum,a as TUNDISH_STATE_CYCLE,l as getStatus,c as specialComponentsRepository};
//# sourceMappingURL=helpers-DI-6W7Gt.js.map