import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * 查询手工短信列表
 * @param query
 * @returns {*}
 */

export const listManualInfo = (query) => {
  return request({
    url: '/msg/manualInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询短信服务商
 */
export const getServiceConfig = () => {
  return request({
    url: '/msg/smsServiceConfig/validSmsServiceConfig',
    method: 'post'
  });
};

/**
 * 查询短信模版
 */
export const getSmsTempList = (sign: string) => {
  const data = {
    sign
  };
  return request({
    url: '/msg/mestemp/queryTemplateList',
    method: 'POST',
    data: data
  });
};

/**
 * 新增手工短信申请
 * @param data
 */
export const addManualInfo = (data) => {
  return request({
    url: '/msg/manualInfo/add',
    method: 'post',
    data: data
  });
};

/**
 * 获取手工短信申请详情
 */
export const getManualInfo = (manualId) => {
  const data= {
    manualId
  };
  return request({
    url: '/msg/manualInfo/getManualInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改手工短信申请详情
 * @param data
 */
export const updateManualInfo = (data) => {
  return request({
    url: '/msg/manualInfo/update',
    method: 'post',
    data: data
  });
};

/**
 * 查询手工短信附件列表
 * @param data
 */
export const getfileListByManualId = (manualId) => {
  const data={
    manualId
  };
  return request({
    url: '/msg/manualInfo/getfileListByManualId',
    method: 'post',
    data: data
  });
};

/**
 * 删除附件
 * @param data
 */
export const deleteFile = (data) => {
  return request({
    url: '/msg/manualInfo/deleteFile',
    method: 'post',
    data: data
  });
};

/**
 * 查询附件处理详情
 * @param data
 */
export const getFileDetail = (data) => {
  return request({
    url: '/msg/manualInfo/getFileDetail',
    method: 'get',
    params: data
  });
};

/**
 * 申请确认提交
 */
export const applayConfirm = (manualId) => {
  const data = {
    manualId
  };
  return request({
    url: '/msg/manualInfo/applayConfirm',
    method: 'post',
    data: data
  });
};

/**
 * 撤销申请
 */
export const revokeSmsManualApply = (manualId) => {
  return request({
    url: '/msg/manualInfo/revokeSmsManualApply',
    method: 'post',
    data: manualId
  });
};

/**
 * 审核确认提交
 */
export const reviewConfirm = (manualId, reviewStatus, failReason) => {
  const data = {
    manualId,
    reviewStatus,
    failReason
  };
  return request({
    url: '/msg/manualInfo/reviewConfirm',
    method: 'post',
    data: data
  });
};
