import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AttachmentEmailVO, AttachmentEmailForm, AttachmentEmailQuery } from '@/api/msg/attachmentEmail/types';

/**
 * 查询邮件附件信息列表
 * @param query
 * @returns {*}
 */

export const listAttachmentEmail = (query?: AttachmentEmailQuery): AxiosPromise<AttachmentEmailVO[]> => {
  return request({
    url: '/msg/attachmentEmail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询邮件附件信息详细
 * @param attachmentId
 */
export const getAttachmentEmail = (attachmentId: string | number): AxiosPromise<AttachmentEmailVO> => {
  return request({
    url: '/msg/attachmentEmail/' + attachmentId,
    method: 'get'
  });
};

/**
 * 新增邮件附件信息
 * @param data
 */
export const addAttachmentEmail = (data: AttachmentEmailForm) => {
  return request({
    url: '/msg/attachmentEmail',
    method: 'post',
    data: data
  });
};

/**
 * 修改邮件附件信息
 * @param data
 */
export const updateAttachmentEmail = (data: AttachmentEmailForm) => {
  return request({
    url: '/msg/attachmentEmail',
    method: 'put',
    data: data
  });
};

/**
 * 删除邮件附件信息
 * @param attachmentId
 */
export const delAttachmentEmail = (attachmentId: string | number | Array<string | number>) => {
  return request({
    url: '/msg/attachmentEmail/' + attachmentId,
    method: 'delete'
  });
};
