import{a as g}from"./chunk-GQ6YT56N.js";import{a as m}from"./chunk-4FINMNB4.js";import{c as S}from"./chunk-3K5ADQHQ.js";import{a as f}from"./chunk-56NKV6FU.js";import{m as d}from"./chunk-SOETE4NY.js";import{a as _}from"./chunk-KFDEPCY3.js";import{f as u}from"./chunk-GYAYEJFB.js";import{L as i,aa as x,ea as c,ka as a,r as p}from"./chunk-LEOKSAW2.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 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};
