import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EmailNotificationVO, EmailNotificationForm, EmailNotificationQuery } from '@/api/msg/emailNotification/types';

/**
 * 查询邮件通知接收人配置列表
 * @param query
 * @returns {*}
 */

export const listEmailNotification = (query?: EmailNotificationQuery): AxiosPromise<EmailNotificationVO[]> => {
  return request({
    url: '/msg/emailNotification/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询邮件通知接收人配置详细
 * @param notificationId
 */
export const getEmailNotification = (notificationId: string | number): AxiosPromise<EmailNotificationVO> => {
  return request({
    url: '/msg/emailNotification/' + notificationId,
    method: 'get'
  });
};

/**
 * 新增邮件通知接收人配置
 * @param data
 */
export const addEmailNotification = (data: EmailNotificationForm) => {
  return request({
    url: '/msg/emailNotification',
    method: 'post',
    data: data
  });
};

/**
 * 修改邮件通知接收人配置
 * @param data
 */
export const updateEmailNotification = (data: EmailNotificationForm) => {
  return request({
    url: '/msg/emailNotification',
    method: 'put',
    data: data
  });
};

/**
 * 删除邮件通知接收人配置
 * @param notificationId
 */
export const delEmailNotification = (notificationId: string | number | Array<string | number>) => {
  return request({
    url: '/msg/emailNotification/' + notificationId,
    method: 'delete'
  });
};
