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

export const apiGetAdminTickets = (params) => http.get(endpoints.getTicketsList, { params })

export const apiShowAdminTicket = (id) => http.get(buildUrl(endpoints.showTicket, { id }))

export const apiSendAdminTicketMessage = (id, payload) =>
  http.post(buildUrl(endpoints.sendTicketMessage, { id }), payload)

// Backend uses PATCH (not POST).
export const apiChangeAdminTicketStatus = (id, payload) =>
  http.patch(buildUrl(endpoints.changeTicketStatus, { id }), payload)
