import{c as l,e as m}from"./chunk-GS6KOUJN.js";import{m as n}from"./chunk-WMRP6X7F.js";import{a as y}from"./chunk-ACIZE7HS.js";import{a as h}from"./chunk-KOXD6BDO.js";import{a,e as c}from"./chunk-EMTGVP7F.js";import{$ as s,K as i,da as p,ja as r}from"./chunk-A4WWLITB.js";var d=(()=>{class o{constructor(e){this._http=e}authorizeEmployee(e){return this._http.get(`/api/user/companies/${e}/authorize`)}findUserByLogin(e){let t=new a().append(h.SkipError,"skipError");return this._http.get(`/api/user/${e}/find`,{headers:t})}getEmployees(e){return this._http.post("/api/employee/all",e,{headers:y})}getEmployeeById(e){return this._http.get(`/api/employee/${e}`)}createNewEmployee(e){return this._http.post("/api/employee",e)}editEmployee(e,t){return this._http.put(`/api/employee/${e}`,t)}removeEmployee(e){return this._http.delete(`/api/employee/${e}`)}authByCode(e){return this._http.post(`/api/user/authorize-by-code?code=${e}`,{})}static{this.\u0275fac=function(t){return new(t||o)(r(c))}}static{this.\u0275prov=p({token:o,factory:o.\u0275fac})}}return o})();var g=(()=>{class o{constructor(e,t){this._employeeServiceApi=e,this._store=t}authorizeEmployee(e){return this._employeeServiceApi.authorizeEmployee(e).pipe(s(t=>{this._store.dispatch(new m),this._store.dispatch(new l(t))}),i(1))}getEmployees(e){return this._employeeServiceApi.getEmployees(e).pipe(i(1))}getEmployeeById(e){return this._employeeServiceApi.getEmployeeById(e).pipe(i(1))}createNewEmployee(e,t){return this._employeeServiceApi.createNewEmployee(this._toCreateFormModel(e,t)).pipe(i(1))}editEmployee(e,t){return this._employeeServiceApi.editEmployee(e,this._toEditFormModel(t)).pipe(i(1))}removeEmployee(e){return this._employeeServiceApi.removeEmployee(e).pipe(i(1))}findUserByLogin(e){return this._employeeServiceApi.findUserByLogin(e).pipe(i(1))}authByCode(e){return this._employeeServiceApi.authByCode(e).pipe(i(1))}_toCreateFormModel(e,t){return{userId:e,cashboxIds:t.cashboxes,storeIds:t.retailStores,roleId:t.role,accessToSalesMode:t.accessToSalesMode,accessToCabinet:t.accessToCabinet,authorizationCode:t.authorizationCode}}_toEditFormModel(e){return{cashboxIds:e.cashboxes,storeIds:e.retailStores,roleId:e.role,accessToSalesMode:e.accessToSalesMode,accessToCabinet:e.accessToCabinet,authorizationCode:e.authorizationCode}}static{this.\u0275fac=function(t){return new(t||o)(r(d),r(n))}}static{this.\u0275prov=p({token:o,factory:o.\u0275fac})}}return o})();export{d as a,g as b};
