import{c as u}from"./chunk-Z6SX4HYB.js";import{l as g,n as a}from"./chunk-GD42XZQD.js";import{p as h}from"./chunk-JBWPPKX4.js";import{a as c}from"./chunk-7N232KV6.js";import{i as y}from"./chunk-NDLDFKR2.js";import{$ as r,K as n,fa as o,ka as s}from"./chunk-PVUKHE45.js";import{a as m}from"./chunk-MZPAXKJS.js";var S=(()=>{let e=class e{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,i){return this._http.put(`/api/company/${t}`,i)}getCompanySettings(t){return this._http.get(`/api/company/${t}/settings`)}changeCompanySettings(t,i){return this._http.put(`/api/company/${t}/settings`,m({},i))}getCompanyNotificationSettings(t){return this._http.get(`/api/company/${t}/notification-settings`)}changeCompanyNotificationSettings(t,i){return this._http.put(`/api/company/${t}/notification-settings`,{settings:i})}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})}};e.\u0275fac=function(i){return new(i||e)(s(y))},e.\u0275prov=o({token:e,factory:e.\u0275fac});let p=e;return p})();var j=(()=>{let e=class e{constructor(t,i,C){this._companyServiceApi=t,this._retailStoreService=i,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(r(t=>this._store.dispatch(new g(t))),n(1))}getStoreByCompanyId(t){return this._companyServiceApi.getStoreByCompanyId(t).pipe(n(1))}registerCompany(t,i){return this._companyServiceApi.registerCompany(this._toRegisterModel(t,i)).pipe(r(()=>this.getCompanies().subscribe()),n(1))}editCompany(t,i){return this._companyServiceApi.editCompany(t,this._toEditModel(i)).pipe(r(()=>{this.getCompanies().subscribe(),this._retailStoreService.getStores().subscribe()}),n(1))}getCompanySettings(t){return this._companyServiceApi.getCompanySettings(t).pipe(r(i=>this._store.dispatch(new a(i))),n(1))}changeCompanySettings(t,i){return this._companyServiceApi.changeCompanySettings(t,i).pipe(r(()=>this._store.dispatch(new a(i))),n(1))}syncOperations(t){return this._companyServiceApi.syncOperations(t).pipe(n(1))}syncCompanySettings(){return this._companyServiceApi.syncCompanySettings().pipe(n(1))}getCompanyNotificationSettings(t){return this._companyServiceApi.getCompanyNotificationSettings(t).pipe(n(1))}changeCompanyNotificationSettings(t,i){return this._companyServiceApi.changeCompanyNotificationSettings(t,i).pipe(n(1))}_toRegisterModel(t,i){return{xin:t.xin.replace(/\s/g,""),address:t.address,fullname:t.name,legalForm:t.form,city:t.city,serviceCenterId:i}}_toEditModel(t){return{xin:t.xin.replace(/\s/g,""),address:t.address,fullname:t.name,legalForm:t.form,city:t.city}}};e.\u0275fac=function(i){return new(i||e)(s(S),s(u),s(h))},e.\u0275prov=o({token:e,factory:e.\u0275fac});let p=e;return p})();export{S as a,j as b};
//# sourceMappingURL=chunk-RDYBNBRU.js.map
