import{c as u}from"./chunk-J2FWBKXX.js";import{j as g,l as a}from"./chunk-EO7RCNTX.js";import{a as c}from"./chunk-PLVHWZTL.js";import{o as h}from"./chunk-M6NTKB7A.js";import{i as y}from"./chunk-YMOV4UGM.js";import{$ as p,K as n,ga as o,la as s}from"./chunk-I3FGJX2C.js";import{a as m}from"./chunk-B7YGBANW.js";var S=(()=>{let i=class i{constructor(t){this._http=t}isCompanyExist(t){return this._http.get(`/api/company/${t}/exist`)}getCompanyByXin(t){return this._http.get(`/api/company/${t}/registration/info`)}getCompanies(){return this._http.get("/api/user/companies")}getStoreByCompanyId(t){return this._http.get(`/api/company/${t}/stores`)}registerCompany(t){return this._http.post("/api/company",t)}editCompany(t,e){return this._http.put(`/api/company/${t}`,e)}getCompanySettings(t){return this._http.get(`/api/company/${t}/settings`)}changeCompanySettings(t,e){return this._http.put(`/api/company/${t}/settings`,m({},e))}syncOperations(t){return this._http.post(`/api/company/${t}/go-to-online`,{},{headers:c})}syncCompanySettings(){return this._http.post("/api/company/settings/sync",{},{headers:c})}};i.\u0275fac=function(e){return new(e||i)(s(y))},i.\u0275prov=o({token:i,factory:i.\u0275fac});let r=i;return r})();var I=(()=>{let i=class i{constructor(t,e,C){this._companyServiceApi=t,this._retailStoreService=e,this._store=C}isCompanyExist(t){return this._companyServiceApi.isCompanyExist(t).pipe(n(1))}getCompanyByXin(t){return this._companyServiceApi.getCompanyByXin(t).pipe(n(1))}getCompanies(){return this._companyServiceApi.getCompanies().pipe(p(t=>this._store.dispatch(new g(t))),n(1))}getStoreByCompanyId(t){return this._companyServiceApi.getStoreByCompanyId(t).pipe(n(1))}registerCompany(t,e){return this._companyServiceApi.registerCompany(this._toRegisterModel(t,e)).pipe(p(()=>this.getCompanies().subscribe()),n(1))}editCompany(t,e){return this._companyServiceApi.editCompany(t,this._toEditModel(e)).pipe(p(()=>{this.getCompanies().subscribe(),this._retailStoreService.getStores().subscribe()}),n(1))}getCompanySettings(t){return this._companyServiceApi.getCompanySettings(t).pipe(p(e=>this._store.dispatch(new a(e))),n(1))}changeCompanySettings(t,e){return this._companyServiceApi.changeCompanySettings(t,e).pipe(p(()=>this._store.dispatch(new a(e))),n(1))}syncOperations(t){return this._companyServiceApi.syncOperations(t).pipe(n(1))}syncCompanySettings(){return this._companyServiceApi.syncCompanySettings().pipe(n(1))}_toRegisterModel(t,e){return{xin:t.xin.replace(/\s/g,""),address:t.address,fullname:t.name,legalForm:t.form,city:t.city,serviceCenterId:e}}_toEditModel(t){return{address:t.address,fullname:t.name,legalForm:t.form,city:t.city}}};i.\u0275fac=function(e){return new(e||i)(s(S),s(u),s(h))},i.\u0275prov=o({token:i,factory:i.\u0275fac});let r=i;return r})();export{S as a,I as b};
//# sourceMappingURL=chunk-2LZEVDHE.js.map
