import request from '@/utils/request';
import { WhatsAppUserQuery, WhatsAppUserForm } from './types';

export function listWhatsAppUser(query: WhatsAppUserQuery) {
  return request({
    url: '/talk/admin/whatsapp/user/list',
    method: 'get',
    params: query
  });
}

export function getWhatsAppUser(id: string | number) {
  return request({
    url: '/talk/admin/whatsapp/user/' + id,
    method: 'get'
  });
}

export function addWhatsAppUser(data: WhatsAppUserForm) {
  return request({
    url: '/talk/admin/whatsapp/user',
    method: 'post',
    data: data
  });
}

export function updateWhatsAppUser(data: WhatsAppUserForm) {
  return request({
    url: '/talk/admin/whatsapp/user',
    method: 'put',
    data: data
  });
}

export function delWhatsAppUser(id: string | number | Array<string | number>) {
  return request({
    url: '/talk/admin/whatsapp/user/' + id,
    method: 'delete'
  });
}

export function exportWhatsAppUser(query: WhatsAppUserQuery) {
  return request({
    url: '/talk/admin/whatsapp/user/export',
    method: 'post',
    data: query
  });
}
