import{a as g}from"./chunk-EH5XBMEU.js";import{o as m}from"./chunk-JCFMOM7U.js";import{c as S}from"./chunk-UIHP5NJO.js";import{a as f}from"./chunk-S77V5ZYX.js";import{m as d}from"./chunk-WMRP6X7F.js";import{a as _}from"./chunk-ACIZE7HS.js";import{e as u}from"./chunk-EMTGVP7F.js";import{$ as x,K as i,da as c,ja as a,r as p}from"./chunk-A4WWLITB.js";import{b,i as l}from"./chunk-QOJKCMZT.js";import{a as o,b as n}from"./chunk-K4ALXBGI.js";l();var h=class s{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:_})}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`,{})}static{this.\u0275fac=function(t){return new(t||s)(a(u))}}static{this.\u0275prov=c({token:s,factory:s.\u0275fac})}};b([f(S.selectedStoreId)],h.prototype,"_retailStoreId",void 0);var P=(()=>{class s{constructor(t,r,C){this._cashboxesServiceApi=t,this._accountsServiceApi=r,this._store=C}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,r){return this._cashboxesServiceApi.editCashbox(t,r).pipe(i(1))}getAccountsForPaymentMethods(){return this._accountsServiceApi.getAccounts().pipe(i(1),p(t=>t.data),p(t=>t.filter(r=>r.useAsPaymentMethod&&r.type!==1)))}getAllCashboxes(){return this._cashboxesServiceApi.getCashboxes().pipe(x(t=>{this._store.dispatch(new m(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))}static{this.\u0275fac=function(r){return new(r||s)(a(h),a(g),a(d))}}static{this.\u0275prov=c({token:s,factory:s.\u0275fac})}}return s})();export{h as a,P as b};
