import{c as h}from"./chunk-UBWF5ENA.js";import{i as y,k as s}from"./chunk-4SIJUOYU.js";import{m}from"./chunk-A7R3CFJO.js";import{x as c}from"./chunk-OIJW4GMG.js";import{J as r,_ as n,ca as o,ia as p}from"./chunk-3FIHWXA5.js";import{a}from"./chunk-K4ALXBGI.js";var g=(()=>{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`,a({},e))}syncOperations(t){return this._http.post(`/api/company/${t}/go-to-online`,{})}static{this.\u0275fac=function(e){return new(e||i)(p(c))}}static{this.\u0275prov=o({token:i,factory:i.\u0275fac})}}return i})();var b=(()=>{class i{constructor(t,e,u){this._companyServiceApi=t,this._retailStoreService=e,this._store=u}isCompanyExist(t){return this._companyServiceApi.isCompanyExist(t).pipe(r(1))}getCompanyByXin(t){return this._companyServiceApi.getCompanyByXin(t).pipe(r(1))}getCompanies(){return this._companyServiceApi.getCompanies().pipe(n(t=>this._store.dispatch(new y(t))),r(1))}getStoreByCompanyId(t){return this._companyServiceApi.getStoreByCompanyId(t).pipe(r(1))}registerCompany(t){return this._companyServiceApi.registerCompany(this._toRegisterModel(t)).pipe(n(()=>this.getCompanies().subscribe()),r(1))}editCompany(t,e){return this._companyServiceApi.editCompany(t,this._toEditModel(e)).pipe(n(()=>{this.getCompanies().subscribe(),this._retailStoreService.getStores().subscribe()}),r(1))}getCompanySettings(t){return this._companyServiceApi.getCompanySettings(t).pipe(n(e=>this._store.dispatch(new s(e))),r(1))}changeCompanySettings(t,e){return this._companyServiceApi.changeCompanySettings(t,e).pipe(n(()=>this._store.dispatch(new s(e))),r(1))}syncOperations(t){return this._companyServiceApi.syncOperations(t).pipe(r(1))}_toRegisterModel(t){return{xin:t.xin.replace(/\s/g,""),address:t.address,fullname:t.name,legalForm:t.form}}_toEditModel(t){return{address:t.address,fullname:t.name,legalForm:t.form}}static{this.\u0275fac=function(e){return new(e||i)(p(g),p(h),p(m))}}static{this.\u0275prov=o({token:i,factory:i.\u0275fac})}}return i})();export{g as a,b};
