import { http } from '@/services/api/http'
import { buildUrl, endpoints } from '@/services/api/endpoints'

export const apiGetAdminUsers = (params) => http.get(endpoints.getApprovedUsers, { params })

export const apiShowAdminUser = (id) => http.get(buildUrl(endpoints.showUserDetails, { id }))

export const apiGetAdminUserRegisterData = (id) =>
  http.get(buildUrl(endpoints.getUserRegisterData, { id }))

export const apiAddAdminUser = (payload) => http.post(endpoints.addNewUser, payload)

export const apiUpdateAdminUser = (id, payload) =>
  http.patch(buildUrl(endpoints.updateUser, { id }), payload)

export const apiUpdateAdminUserRole = (id, payload) =>
  http.patch(buildUrl(endpoints.updateUserRole, { id }), payload)

export const apiChangeAdminUserStatus = (id, payload) =>
  http.patch(buildUrl(endpoints.changeUserStatus, { id }), payload)

export const apiDeleteAdminUser = (id) => http.delete(buildUrl(endpoints.deleteUser, { id }))
