import{a as n}from"./chunk-OR5WJ2OD.js";import{a as l}from"./chunk-7LB63SXX.js";import{o as u}from"./chunk-GW2OL5S3.js";import{a}from"./chunk-P5XIDEFS.js";import{i as h}from"./chunk-CO3WTSA4.js";import{I as p,Z as c,ea as o,ja as s}from"./chunk-DYUFV4HF.js";var d=(()=>{let t=class t{constructor(e){this._http=e}createPrice(e){return this._http.post("/api/price",e)}updatePrice(e,i){return this._http.put(`/api/price/${e}`,i)}deletePrice(e){return this._http.delete(`/api/price/${e}`)}getPrices(e=!1){return e?this._http.post("/api/price/all",{},{headers:a}):this._http.post("/api/price/all",{})}syncPrice(){return this._http.post("/api/price/sync",{},{headers:a})}};t.\u0275fac=function(i){return new(i||t)(s(h))},t.\u0275prov=o({token:t,factory:t.\u0275fac});let r=t;return r})();var A=(()=>{let t=class t{constructor(e,i){this._priceServiceApi=e,this._store=i}createPrice(e){return this._priceServiceApi.createPrice(this._toUpsertModel(e)).pipe(c(()=>this.getPrices().subscribe()),p(1))}updatePrice(e,i){return this._priceServiceApi.updatePrice(e,this._toUpsertModel(i)).pipe(c(()=>this.getPrices().subscribe()),p(1))}deletePrice(e){return this._priceServiceApi.deletePrice(e).pipe(c(()=>this.getPrices().subscribe()),p(1))}getPrices(e=!1){return this._priceServiceApi.getPrices(e).pipe(c(i=>this._store.dispatch(new l({prices:i}))),p(1))}syncPrice(){return this._priceServiceApi.syncPrice().pipe(p(1))}_toUpsertModel(e){return{type:e.type,name:e.name,from:e.period?n(e.period[0]):null,to:e.period?n(e.period[1]):null}}};t.\u0275fac=function(i){return new(i||t)(s(d),s(u))},t.\u0275prov=o({token:t,factory:t.\u0275fac});let r=t;return r})();export{d as a,A as b};
//# sourceMappingURL=chunk-F43KEH5M.js.map
