import httpClient from './httpClient';

export const postService = {
    getPosts({ page = 1, limit = 10, keyword = '' } = {}) {
        return httpClient.get('/admin/posts', {
            params: {
                page,
                limit,
                keyword: keyword.trim()
            }
        });
    },
    getPost(id) {
        return httpClient.get(`/admin/posts/${id}`);
    },
    createPost(post) {
        return httpClient.post('/admin/posts', post);
    },

    updatePost(id, post) {
        return httpClient.put(`/admin/posts/${id}`, post);
    },
    deletePost(id) {
        return httpClient.delete(`/admin/posts/${id}`);
    },
    sendTo(id, userId) {
        return httpClient.post(`/admin/posts/${id}/send-to/${userId}`);
    },
}