import{a as A}from"./chunk-JGB757OO.js";import{a as _,b as f}from"./chunk-Y5ZINRNV.js";import{c as C}from"./chunk-IXRBBB6V.js";import{a as u}from"./chunk-PLVHWZTL.js";import{a as l}from"./chunk-FPRDBDVD.js";import{o as m}from"./chunk-M6NTKB7A.js";import{i as g}from"./chunk-YMOV4UGM.js";import{$ as x,K as s,ga as c,la as o,q as b}from"./chunk-I3FGJX2C.js";import{d as S,n as v}from"./chunk-INB5GR2I.js";import{a as h,b as d}from"./chunk-B7YGBANW.js";v();var a=class a{constructor(t){this._http=t,this._defaultFilter={criteria:null,take:100,skip:0,orderBy:"id",isAscending:!0}}getCashboxes(t=this._defaultFilter){let r=d(h({},t),{criteria:{storeId:this._retailStoreId}});return this._http.post("/api/cashbox/all",h({},r),{headers:u})}getCashbox(t){return this._http.get(`/api/cashbox/${t}`)}editCashbox(t,r){return this._http.put(`/api/cashbox/${t}`,h({},r))}createCashbox(t){return this._http.post("/api/cashbox",h({},t))}getCashboxesByStoreId(t){return this._http.get(`/api/store/${t}/cashboxes`)}getSyncState(t){return this._http.get(`/api/store/${t}/last-sync-state`)}bindCashbox(t){return this._http.post(`/api/cashbox/${t}/bind`,{})}getBindStatus(t){return this._http.get(`/api/cashbox/${t}/bind-status`)}getCashboxState(t){return this._http.get(`/api/cashbox/${t}/state`)}unbindCashbox(t){return this._http.post(`/api/cashbox/${t}/unbind`,{})}settingsCashbox(t,r){return this._http.put(`/api/cashbox/${t}/settings`,r)}syncCashbox(){return this._http.post("/api/cashbox/sync",{},{headers:u})}};a.\u0275fac=function(r){return new(r||a)(o(g))},a.\u0275prov=c({token:a,factory:a.\u0275fac});var p=a;S([l(C.selectedStoreId)],p.prototype,"_retailStoreId",void 0);var U=(()=>{let t=class t{constructor(e,i,y){this._cashboxesServiceApi=e,this._accountsServiceApi=i,this._store=y}getCashboxes(e){return this._cashboxesServiceApi.getCashboxes(e).pipe(s(1))}getById(e){return this._cashboxesServiceApi.getCashbox(e).pipe(s(1))}create(e){return this._cashboxesServiceApi.createCashbox(e).pipe(s(1))}edit(e,i){return this._cashboxesServiceApi.editCashbox(e,i).pipe(s(1))}getAccountsForPaymentMethods(){return this._accountsServiceApi.getAccounts().pipe(s(1),b(e=>e.data),b(e=>e.filter(i=>i.useAsPaymentMethod&&i.type!==1)))}getAllCashboxes(){return this._cashboxesServiceApi.getCashboxes().pipe(x(e=>{this._store.dispatch(new _(e.data))}))}getSyncState(e){return this._cashboxesServiceApi.getSyncState(e).pipe(s(1))}bindCashbox(e){return this._cashboxesServiceApi.bindCashbox(e).pipe(s(1))}getBindStatus(e){return this._cashboxesServiceApi.getBindStatus(e).pipe(s(1))}getCashboxState(e){return this._cashboxesServiceApi.getCashboxState(e)}unbindCashbox(e){return this._cashboxesServiceApi.unbindCashbox(e).pipe(s(1))}getCashboxesByStoreId(e){return this._cashboxesServiceApi.getCashboxesByStoreId(e).pipe(s(1))}settingsCashbox(e,i){return this._cashboxesServiceApi.settingsCashbox(e,i).pipe(x(()=>{this._store.dispatch(new f(e,i))}))}syncCashbox(){return this._cashboxesServiceApi.syncCashbox().pipe(s(1))}};t.\u0275fac=function(i){return new(i||t)(o(p),o(A),o(m))},t.\u0275prov=c({token:t,factory:t.\u0275fac});let n=t;return n})();export{p as a,U as b};
//# sourceMappingURL=chunk-2GXVCVJX.js.map
