import api from './index';

// --- User APIs ---
export const getUsers = () => api.get('/system/users');
export const createUser = (data: any) => api.post('/system/users', data);
export const updateUser = (id: string, data: any) => api.put(`/system/users/${id}`, data);
export const deleteUser = (id: string) => api.delete(`/system/users/${id}`);

// --- Role APIs ---
export const getRoles = (params?: any) => api.get('/system/roles', { params });
export const createRole = (data: any) => api.post('/system/roles', data);
export const updateRole = (id: string, data: any) => api.put(`/system/roles/${id}`, data);
export const deleteRole = (id: string) => api.delete(`/system/roles/${id}`);

// --- Menu APIs ---
export const getMenuTree = () => api.get('/system/menu/tree');
export const getRoleMenuIds = (roleId: string) => api.get(`/system/role/${roleId}/menus`);

// --- Config APIs ---
export const getAllConfigs = () => api.get('/system/configs');
export const getConfig = (key: string) => api.get(`/system/config/${key}`);
export const updateConfig = (data: any) => api.post('/system/config', data);
