import{a as l}from"./chunk-TRSQVSS2.js";import{a as _}from"./chunk-CCKSEROE.js";import{c as C}from"./chunk-SRKRR7GV.js";import{a as x}from"./chunk-C2ZF4U5U.js";import{a as f}from"./chunk-TWAW6QQO.js";import{o as m}from"./chunk-AEEDSABA.js";import{i as g}from"./chunk-JLM6CY35.js";import{J as s,_ as S,fa as c,ka as o,q as b}from"./chunk-4HRPSKID.js";import{d,n as y}from"./chunk-INB5GR2I.js";import{a as h,b as u}from"./chunk-B7YGBANW.js";y();var a=class a{constructor(t){this._http=t,this._defaultFilter={criteria:null,take:100,skip:0,orderBy:"id",isAscending:!0}}getCashboxes(t=this._defaultFilter){let r=u(h({},t),{criteria:{storeId:this._retailStoreId}});return this._http.post("/api/cashbox/all",h({},r),{headers:x})}getCashbox(t){return this._http.get(`/api/cashbox/${t}`)}editCashbox(t,r){return this._http.put(`/api/cashbox/${t}`,h({},r))}createCashbox(t){return this._http.post("/api/cashbox",h({},t))}getCashboxesByStoreId(t){return this._http.get(`/api/store/${t}/cashboxes`)}getSyncState(t){return this._http.get(`/api/store/${t}/last-sync-state`)}bindCashbox(t){return this._http.post(`/api/cashbox/${t}/bind`,{})}getBindStatus(t){return this._http.get(`/api/cashbox/${t}/bind-status`)}getCashboxState(t){return this._http.get(`/api/cashbox/${t}/state`)}unbindCashbox(t){return this._http.post(`/api/cashbox/${t}/unbind`,{})}settingsCashbox(t,r){return this._http.put(`/api/cashbox/${t}/settings`,r)}syncCashbox(){return this._http.post("/api/cashbox/sync",{},{headers:x})}};a.\u0275fac=function(r){return new(r||a)(o(g))},a.\u0275prov=c({token:a,factory:a.\u0275fac});var p=a;d([f(C.selectedStoreId)],p.prototype,"_retailStoreId",void 0);var R=(()=>{let t=class t{constructor(e,i,A){this._cashboxesServiceApi=e,this._accountsServiceApi=i,this._store=A}getCashboxes(e){return this._cashboxesServiceApi.getCashboxes(e).pipe(s(1))}getById(e){return this._cashboxesServiceApi.getCashbox(e).pipe(s(1))}create(e){return this._cashboxesServiceApi.createCashbox(e).pipe(s(1))}edit(e,i){return this._cashboxesServiceApi.editCashbox(e,i).pipe(s(1))}getAccountsForPaymentMethods(){return this._accountsServiceApi.getAccounts().pipe(s(1),b(e=>e.data),b(e=>e.filter(i=>i.useAsPaymentMethod&&i.type!==1)))}getAllCashboxes(){return this._cashboxesServiceApi.getCashboxes().pipe(S(e=>{this._store.dispatch(new _(e.data))}))}getSyncState(e){return this._cashboxesServiceApi.getSyncState(e).pipe(s(1))}bindCashbox(e){return this._cashboxesServiceApi.bindCashbox(e).pipe(s(1))}getBindStatus(e){return this._cashboxesServiceApi.getBindStatus(e).pipe(s(1))}getCashboxState(e){return this._cashboxesServiceApi.getCashboxState(e)}unbindCashbox(e){return this._cashboxesServiceApi.unbindCashbox(e).pipe(s(1))}getCashboxesByStoreId(e){return this._cashboxesServiceApi.getCashboxesByStoreId(e).pipe(s(1))}settingsCashbox(e,i){return this._cashboxesServiceApi.settingsCashbox(e,i).pipe(s(1))}syncCashbox(){return this._cashboxesServiceApi.syncCashbox().pipe(s(1))}};t.\u0275fac=function(i){return new(i||t)(o(p),o(l),o(m))},t.\u0275prov=c({token:t,factory:t.\u0275fac});let n=t;return n})();export{p as a,R as b};
//# sourceMappingURL=chunk-D66YVF67.js.map
