import{c as g}from"./chunk-5QUMV2KP.js";import{l as h,n as s}from"./chunk-3WWEFG5Z.js";import{m as y}from"./chunk-OWZ5YAMH.js";import{a}from"./chunk-KXX3UDJ3.js";import{j as m}from"./chunk-GQAU5ACB.js";import{S as e,fa as p,la as o,pa as r}from"./chunk-ISMRT7VU.js";import{a as c}from"./chunk-M5TX2NVG.js";var u=(()=>{class n{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`,c({},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:a})}syncCompanySettings(){return this._http.post("/api/company/settings/sync",{},{headers:a})}static{this.\u0275fac=function(i){return new(i||n)(r(m))}}static{this.\u0275prov=o({token:n,factory:n.\u0275fac})}}return n})();var $=(()=>{class n{constructor(t,i,S){this._companyServiceApi=t,this._retailStoreService=i,this._store=S}isCompanyExist(t){return this._companyServiceApi.isCompanyExist(t).pipe(e(1))}getCompanyByXin(t){return this._companyServiceApi.getCompanyByXin(t).pipe(e(1))}getCompanies(){return this._companyServiceApi.getCompanies().pipe(p(t=>this._store.dispatch(new h(t))),e(1))}getStoreByCompanyId(t){return this._companyServiceApi.getStoreByCompanyId(t).pipe(e(1))}registerCompany(t,i){return this._companyServiceApi.registerCompany(this._toRegisterModel(t,i)).pipe(p(()=>this.getCompanies().subscribe()),e(1))}editCompany(t,i){return this._companyServiceApi.editCompany(t,this._toEditModel(i)).pipe(p(()=>{this.getCompanies().subscribe(),this._retailStoreService.getStores().subscribe()}),e(1))}getCompanySettings(t){return this._companyServiceApi.getCompanySettings(t).pipe(p(i=>this._store.dispatch(new s(i))),e(1))}changeCompanySettings(t,i){return this._companyServiceApi.changeCompanySettings(t,i).pipe(p(()=>this._store.dispatch(new s(i))),e(1))}syncOperations(t){return this._companyServiceApi.syncOperations(t).pipe(e(1))}syncCompanySettings(){return this._companyServiceApi.syncCompanySettings().pipe(e(1))}getCompanyNotificationSettings(t){return this._companyServiceApi.getCompanyNotificationSettings(t).pipe(e(1))}changeCompanyNotificationSettings(t,i){return this._companyServiceApi.changeCompanyNotificationSettings(t,i).pipe(e(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}}static{this.\u0275fac=function(i){return new(i||n)(r(u),r(g),r(y))}}static{this.\u0275prov=o({token:n,factory:n.\u0275fac})}}return n})();export{u as a,$ as b};
//# sourceMappingURL=chunk-VLRSPYRE.js.map
