import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TemplateInfoQuery, TemplateInfoVO } from '@/api/print/template/templateInfotypes';

/**
 * 查询申请、审核信息列表
 * @param query
 * @returns {*}
 */

export const listReviewInfo = (query?: TemplateInfoQuery): AxiosPromise<TemplateInfoVO[]> => {
  return request({
    url: '/print/reviewInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 下载模版文件
 * @param reviewId
 */
export const getDownloadAttType = (templateId: string | number) =>{
  const data = {
    templateId
  };
  return request({
    url: '/print/reviewInfo/getDownloadAttType',
    method: 'post',
    data: data
  });
};

/**
 * 模版审核通过
 * @param templateId
 */

export const getPreviewPassed = (templateId: string | number) => {
  const data = {
    templateId
  };
  return request({
    url: '/print/reviewInfo/previewPassed',
    method: 'post',
    data: data
  });
};

/**
 * 模版审核不通过
 * @param params
 */
export const getPreviewFailed = (params: { templateId: string | number; reason: string }) => {
  return request({
    url: '/print/reviewInfo/previewFailed',
    method: 'post',
    data: params
  });
};
