import { HttpClient } from '../http-client'; import type { BaseResponse } from '../types/common'; import type { RoleRegisterRequest, RoleRegisterResponse, RoleResponse, RoleUpdateRequest } from '../types/role.types'; class RoleService { private http: HttpClient; constructor(http: HttpClient) { this.http = http; } async register(data: RoleRegisterRequest): Promise { return this.http.requestAndValidate('/roles/register', { method: 'POST', body: data }); } async update(data: RoleUpdateRequest): Promise { return this.http.requestAndValidate('/roles/update', { method: 'POST', body: data }); } async delete(id: string): Promise { return this.http.requestAndValidate('/roles/delete', { method: 'POST', body: { id } }); } async getById(id: string): Promise { return this.http.requestAndValidate('/roles/get-by-id', { method: 'POST', body: { id } }); } async getByCode(code: string, tenantId?: string): Promise { return this.http.requestAndValidate('/roles/get-by-code', { method: 'POST', body: { code, tenantId } }); } } export { RoleService };