import{a as n}from"./chunk-AANUGJO2.js";import{a as l}from"./chunk-7LB63SXX.js";import{n as u}from"./chunk-DC6G5OHZ.js";import{a}from"./chunk-JUPKAJPM.js";import{i as h}from"./chunk-Z2AWIQRI.js";import{L as p,aa as c,ia as o,na as s}from"./chunk-C2QKZJOP.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-YLT5F6J5.js.map
