import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EmailsendVO, EmailsendForm, EmailsendQuery } from '@/api/msg/emailsend/types';

/**
 * 查询邮件发送记录列表
 * @param query
 * @returns {*}
 */

export const listEmailsend = (query?: EmailsendQuery): AxiosPromise<EmailsendVO[]> => {
  return request({
    url: '/msg/emailsend/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询邮件发送记录详细
 * @param sendId
 */
export const getEmailsend = (sendId: string | number): AxiosPromise<EmailsendVO> => {
  return request({
    url: '/msg/emailsend/' + sendId,
    method: 'get'
  });
};

/**
 * 新增邮件发送记录
 * @param data
 */
export const addEmailsend = (data: EmailsendForm) => {
  return request({
    url: '/msg/emailsend',
    method: 'post',
    data: data
  });
};

/**
 * 修改邮件发送记录
 * @param data
 */
export const updateEmailsend = (data: EmailsendForm) => {
  return request({
    url: '/msg/emailsend',
    method: 'put',
    data: data
  });
};

/**
 * 删除邮件发送记录
 * @param sendId
 */
export const delEmailsend = (sendId: string | number | Array<string | number>) => {
  return request({
    url: '/msg/emailsend/' + sendId,
    method: 'delete'
  });
};
