import httpClient from './httpClient';

export const userService = {
    getUsers({ page = 1, limit = 10, keyword = '' } = {}) {
        return httpClient.get('/admin/users', {
            params: {
                page,
                limit,
                keyword: keyword.trim()
            }
        });
    },
    searchUser(id) {
        return httpClient.get(`/admin/users/${id}`);
    },
    userBalance(id, balance) {
        return httpClient.post(`/admin/users/${id}/balance`, {
            balance
        });
    },
    getUser(id) {
        return httpClient.get(`/admin/users/${id}`);
    },
    deleteUser(id) {
        return httpClient.delete(`/admin/users/${id}`);
    },
    getUserById(id) {
        return httpClient.get(`/admin/users/${id}`);
    },
    getUserArticles(userId, page, limit) {
        return httpClient.get(`/admin/users/${userId}/articles`, {
            params: {
                page,
                limit,
            }
        });
    }
}