import{a as C}from"./chunk-C5X7AJAJ.js";import{a as g}from"./chunk-IANHTRR4.js";import{c as d}from"./chunk-YZGKFE6P.js";import{a as _}from"./chunk-MKXPJTAW.js";import{m as S}from"./chunk-3VQS547U.js";import{a as m}from"./chunk-YO44C22F.js";import{f as u}from"./chunk-6VC7H3CZ.js";import{$ as x,K as i,da as p,ja as a,r as c}from"./chunk-QMYHTLAJ.js";import{d as b,n as l}from"./chunk-HE7HQ6LI.js";import{a as o,b as n}from"./chunk-K4ALXBGI.js";l();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=n(o({},e),{criteria:{storeId:this._retailStoreId}});return this._http.post("/api/cashbox/all",o({},t),{headers:m})}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)}static{this.\u0275fac=function(t){return new(t||r)(a(u))}}static{this.\u0275prov=p({token:r,factory:r.\u0275fac})}};b([_(d.selectedStoreId)],h.prototype,"_retailStoreId",void 0);var P=(()=>{class r{constructor(t,s,f){this._cashboxesServiceApi=t,this._accountsServiceApi=s,this._store=f}getCashboxes(t){return this._cashboxesServiceApi.getCashboxes(t).pipe(i(1))}getById(t){return this._cashboxesServiceApi.getCashbox(t).pipe(i(1))}create(t){return this._cashboxesServiceApi.createCashbox(t).pipe(i(1))}edit(t,s){return this._cashboxesServiceApi.editCashbox(t,s).pipe(i(1))}getAccountsForPaymentMethods(){return this._accountsServiceApi.getAccounts().pipe(i(1),c(t=>t.data),c(t=>t.filter(s=>s.useAsPaymentMethod&&s.type!==1)))}getAllCashboxes(){return this._cashboxesServiceApi.getCashboxes().pipe(x(t=>{this._store.dispatch(new g(t.data))}))}getSyncState(t){return this._cashboxesServiceApi.getSyncState(t).pipe(i(1))}bindCashbox(t){return this._cashboxesServiceApi.bindCashbox(t).pipe(i(1))}getBindStatus(t){return this._cashboxesServiceApi.getBindStatus(t).pipe(i(1))}getCashboxState(t){return this._cashboxesServiceApi.getCashboxState(t)}unbindCashbox(t){return this._cashboxesServiceApi.unbindCashbox(t).pipe(i(1))}getCashboxesByStoreId(t){return this._cashboxesServiceApi.getCashboxesByStoreId(t).pipe(i(1))}settingsCashbox(t,s){return this._cashboxesServiceApi.settingsCashbox(t,s).pipe(i(1))}static{this.\u0275fac=function(s){return new(s||r)(a(h),a(C),a(S))}}static{this.\u0275prov=p({token:r,factory:r.\u0275fac})}}return r})();export{h as a,P as b};
