/**
 * Roles resource: list all roles
 */

import type { AxiosInstance } from 'axios';
import type { RoleDTO } from '@effigenix/types';
import { API_PATHS } from '@effigenix/config';

export type { RoleDTO };

export function createRolesResource(client: AxiosInstance) {
  return {
    async list(): Promise<RoleDTO[]> {
      const response = await client.get<RoleDTO[]>(API_PATHS.roles.base);
      return response.data;
    },
  };
}

export type RolesResource = ReturnType<typeof createRolesResource>;
