import{a as g}from"./chunk-PGDL3Q7A.js";import{o as m}from"./chunk-4SIJUOYU.js";import{c as S}from"./chunk-6GCD7JC6.js";import{a as f}from"./chunk-B7E4YH53.js";import{a as _}from"./chunk-NHAEOK7K.js";import{m as d}from"./chunk-A7R3CFJO.js";import{x as u}from"./chunk-OIJW4GMG.js";import{J as i,_ as x,ca as p,ia as a,r as c}from"./chunk-3FIHWXA5.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=p({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),c(t=>t.data),c(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).pipe(i(1))}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=p({token:s,factory:s.\u0275fac})}}return s})();export{h as a,P as b};
