import{a as m}from"./chunk-IIOQELTQ.js";import{a as d}from"./chunk-B7IDLUQV.js";import{A as s,Dc as u,a as i,b as o,ba as n,ha as p,wd as l}from"./chunk-QBQIXSUA.js";var c=class a{url=l.urlApi;http=p(u);cryptoService=p(d);authService=p(m);get_user_data(e){let r=`${this.url}/administrator/user-profile/`+e;return this.http.get(`${r}`)}get_image_user(e,r){let t=`${this.url}/administrator/user-profile/images/`+e+"/"+r;return this.http.get(`${t}`,{responseType:"blob"})}getLoggedUserData(){let e=localStorage.getItem("accessToken"),r=this.cryptoService.decryptData(e??""),t=this.authService.decodeJwtPayload(r);return this.http.get(`${this.url}/administrator/user-profile/${t.userId}`).pipe(s(h=>o(i({},h),{id:t.userId})))}getRoles(){return this.http.get(`${this.url}/administrator/user-profile/roles`).pipe(s(e=>e.types))}getUsers(e){return this.http.post(`${this.url}/administrator/user-profile/users`,e)}getUserData(e){return this.http.get(`${this.url}/administrator/user-profile/${e}`).pipe(s(r=>o(i({},r),{id:e})))}createUser(e){let r=new FormData;return r.append("name",e.name),r.append("surname",e.surname),r.append("email",e.email),r.append("phone",e.phone),r.append("password",e.password),r.append("role",e.role),r.append("photos",e.photo),r.append("licenseNumber",e.licenseNumber),this.http.post(`${this.url}/auth/signup/operators`,r)}updateUser(e){let r=new FormData;return r.append("name",e.name),r.append("surname",e.surname),r.append("email",e.email),r.append("phone",e.phone),r.append("role",e.role),r.append("status",e.status),r.append("licenseNumber",e.licenseNumber),e.password&&r.append("password",e.password),e.photos&&r.append("photos",e.photos),this.http.put(`${this.url}/administrator/user-profile/manage/users/${e.id}`,r)}updateMyProfileData(e){let r=new FormData;return r.append("name",e.name),r.append("surname",e.surname),r.append("phone",e.phone),r.append("licenseNumber",e.licenseNumber),r.append("photos",e.photos),e.password&&r.append("password",e.password),this.http.put(`${this.url}/administrator/user-profile/${e.id}`,r)}disabledUser(e){return this.http.put(`${this.url}/administrator/user-profile/disable/users/${e}`,{})}static \u0275fac=function(r){return new(r||a)};static \u0275prov=n({token:a,factory:a.\u0275fac,providedIn:"root"})};export{c as a};
