import { apiRequest } from '@/shared/api/httpClient';
import type { ApiListResponse } from '@/shared/types/api';

export interface RoleRow {
  readonly id: string;
  readonly name: string | null;
  readonly scope?: string | null;
  readonly permissions?: readonly {
    readonly id: string;
    readonly name: string | null;
  }[];
}

export function listRoles(): Promise<ApiListResponse<RoleRow>> {
  return apiRequest<ApiListResponse<RoleRow>>('/roles?limit=1000');
}
