import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EmailNotificationVO, EmailNotificationForm, EmailNotificationQuery, EmailNotificationQueryBo } from '@/api/product/note/types';

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

export const listEmailNotification = (query: EmailNotificationQueryBo) => {
  return request({
    url: '/product/note/queryPageList',
    method: 'post',
    data: query
  });
};

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

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

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

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