import{a as f}from"./chunk-TTBMNJPA.js";import{d as C,e as g}from"./chunk-ZQPWXQD7.js";import{a as m}from"./chunk-HEWBVLHR.js";import{c as _}from"./chunk-WXQVX7WD.js";import{m as d}from"./chunk-OWZ5YAMH.js";import{a as b}from"./chunk-KXX3UDJ3.js";import{j as S}from"./chunk-GQAU5ACB.js";import{S as s,fa as n,k as u,la as p,pa as a,x as c}from"./chunk-ISMRT7VU.js";import{a as o,b as x}from"./chunk-M5TX2NVG.js";var h=class r{constructor(e){this._http=e,this._defaultFilter={criteria:null,take:100,skip:0,orderBy:"id",isAscending:!0}}getCashboxes(e=this._defaultFilter){let t=x(o({},e),{criteria:{storeId:this._retailStoreId}});return this._http.post("/api/cashbox/all",o({},t),{headers:b})}getCashbox(e){return this._http.get(`/api/cashbox/${e}`)}editCashbox(e,t){return this._http.put(`/api/cashbox/${e}`,o({},t))}createCashbox(e){return this._http.post("/api/cashbox",o({},e))}getCashboxesByStoreId(e){return this._http.get(`/api/store/${e}/cashboxes`)}getSyncState(e){return this._http.get(`/api/store/${e}/last-sync-state`)}bindCashbox(e){return this._http.post(`/api/cashbox/${e}/bind`,{})}getBindStatus(e){return this._http.get(`/api/cashbox/${e}/bind-status`)}getCashboxState(e){return this._http.get(`/api/cashbox/${e}/state`)}unbindCashbox(e){return this._http.post(`/api/cashbox/${e}/unbind`,{})}settingsCashbox(e,t){return this._http.put(`/api/cashbox/${e}/settings`,t)}syncCashbox(){return this._http.post("/api/cashbox/sync",{},{headers:b})}static{this.\u0275fac=function(t){return new(t||r)(a(S))}}static{this.\u0275prov=p({token:r,factory:r.\u0275fac})}};u([m(_.selectedStoreId)],h.prototype,"_retailStoreId",void 0);var P=(()=>{class r{constructor(t,i,l){this._cashboxesServiceApi=t,this._accountsServiceApi=i,this._store=l}getCashboxes(t){return this._cashboxesServiceApi.getCashboxes(t).pipe(s(1))}getById(t){return this._cashboxesServiceApi.getCashbox(t).pipe(s(1))}create(t){return this._cashboxesServiceApi.createCashbox(t).pipe(s(1))}edit(t,i){return this._cashboxesServiceApi.editCashbox(t,i).pipe(s(1))}getAccountsForPaymentMethods(){return this._accountsServiceApi.getAccounts().pipe(s(1),c(t=>t.data),c(t=>t.filter(i=>i.useAsPaymentMethod&&i.type!==1)))}getAllCashboxes(){return this._cashboxesServiceApi.getCashboxes().pipe(n(t=>{this._store.dispatch(new C(t.data))}))}getSyncState(t){return this._cashboxesServiceApi.getSyncState(t).pipe(s(1))}bindCashbox(t){return this._cashboxesServiceApi.bindCashbox(t).pipe(s(1))}getBindStatus(t){return this._cashboxesServiceApi.getBindStatus(t).pipe(s(1))}getCashboxState(t){return this._cashboxesServiceApi.getCashboxState(t)}unbindCashbox(t){return this._cashboxesServiceApi.unbindCashbox(t).pipe(s(1))}getCashboxesByStoreId(t){return this._cashboxesServiceApi.getCashboxesByStoreId(t).pipe(s(1))}settingsCashbox(t,i){return this._cashboxesServiceApi.settingsCashbox(t,i).pipe(n(()=>{this._store.dispatch(new g(t,i))}))}syncCashbox(){return this._cashboxesServiceApi.syncCashbox().pipe(s(1))}static{this.\u0275fac=function(i){return new(i||r)(a(h),a(f),a(d))}}static{this.\u0275prov=p({token:r,factory:r.\u0275fac})}}return r})();export{h as a,P as b};
//# sourceMappingURL=chunk-UETXVRBJ.js.map
