import{c as u}from"./chunk-4WBIDQ26.js";import{k as g,m as a}from"./chunk-B3CI2H5S.js";import{n as h}from"./chunk-DC6G5OHZ.js";import{a as c}from"./chunk-JUPKAJPM.js";import{i as y}from"./chunk-Z2AWIQRI.js";import{L as n,aa as p,ia as o,na as s}from"./chunk-C2QKZJOP.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,serviceCenterId:e}}_toEditModel(t){return{address:t.address,fullname:t.name,legalForm:t.form}}};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-HU2JS7TU.js.map
