import{a as n}from"./chunk-UYMOEMNL.js";import{K as r,da as s,ja as c,r as p}from"./chunk-QMYHTLAJ.js";var d=(()=>{class t{constructor(e){this._roleServiceApi=e}getRoles(e){return this._roleServiceApi.getRoles(e).pipe(r(1))}getRolesForDropdown(){return this._roleServiceApi.getRoles({take:50,orderBy:"id",skip:0,criteria:null,isAscending:!0}).pipe(p(e=>e.data),r(1))}createRole(e){return this._roleServiceApi.createRole(this._toRequestForm(e)).pipe(r(1))}getRoleById(e){return this._roleServiceApi.getRoleById(e).pipe(r(1))}updateRoleById(e,i){return this._roleServiceApi.updateRoleById(this._toRequestForm(e),i).pipe(r(1))}removeRoleById(e){return this._roleServiceApi.removeRoleById(e).pipe(r(1))}_toRequestForm(e){return{nameKk:e.name,nameRu:e.name,permissions:e.groups.reduce((i,l)=>[...i,...l.permissions.filter(o=>o.checked).map(o=>o.id)],[])}}static{this.\u0275fac=function(i){return new(i||t)(c(n))}}static{this.\u0275prov=s({token:t,factory:t.\u0275fac})}}return t})();export{d as a};
