import{c as g}from"./chunk-RE7ESXYK.js";import{i as y,k as s}from"./chunk-VCTLKCBQ.js";import{m}from"./chunk-H7LDOWEY.js";import{a as h}from"./chunk-RPTQV6VH.js";import{f as c}from"./chunk-ZGXE2QDV.js";import{$ as n,K as r,da as o,ja as p}from"./chunk-ZGECHOBP.js";import{a}from"./chunk-K4ALXBGI.js";var u=(()=>{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`,{},{headers:h})}static{this.\u0275fac=function(e){return new(e||i)(p(c))}}static{this.\u0275prov=o({token:i,factory:i.\u0275fac})}}return i})();var x=(()=>{class i{constructor(t,e,S){this._companyServiceApi=t,this._retailStoreService=e,this._store=S}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(u),p(g),p(m))}}static{this.\u0275prov=o({token:i,factory:i.\u0275fac})}}return i})();export{u as a,x as b};
