import{a as u}from"./chunk-NHAEOK7K.js";import{x as s}from"./chunk-OIJW4GMG.js";import{J as o,ca as c,ia as n,r as a}from"./chunk-3FIHWXA5.js";import{a as p}from"./chunk-K4ALXBGI.js";var d=(()=>{class r{constructor(t){this._http=t}createNewDraftDocument(t){return this._http.post("/api/draft-document",p({},t))}getDraftDocumentById(t){return this._http.get(`/api/draft-document/${t}`).pipe(a(e=>(e.body=JSON.parse(e.jsonBody),e)))}editDraftDocument(t,e){return this._http.put(`/api/draft-document/${t}`,e)}deleteDraftDocument(t){return this._http.delete(`/api/draft-document/${t}`)}getAllDraftDocuments(t,e){let i=`/api/draft-document/all?documentType=${t.documentType}&warehouseId=${t.warehouseId}`;return t.cashboxId&&(i+=`&cashboxId=${t.cashboxId}`),this._http.post(i,e,{headers:u})}static{this.\u0275fac=function(e){return new(e||r)(n(s))}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac})}}return r})();var A=(()=>{class r{constructor(t){this._draftServiceApi=t}getDrafts(t,e){return this._draftServiceApi.getAllDraftDocuments(t,e).pipe(a(i=>(i.data.forEach(f=>f.body=JSON.parse(f.jsonBody)),i)),o(1))}createDraft(t){return this._draftServiceApi.createNewDraftDocument(t)}getDraftById(t){return this._draftServiceApi.getDraftDocumentById(t).pipe(a(e=>(e.body=JSON.parse(e.jsonBody),e)),o(1))}editDraft(t,e){return this._draftServiceApi.editDraftDocument(t,e).pipe(o(1))}deleteDraft(t){return this._draftServiceApi.deleteDraftDocument(t).pipe(o(1))}static{this.\u0275fac=function(e){return new(e||r)(n(d))}}static{this.\u0275prov=c({token:r,factory:r.\u0275fac})}}return r})();export{d as a,A as b};
