// @ts-ignore
/* eslint-disable */
import {request} from 'umi';

export async function paperList(params: API.PaperListParams,) {
  return request<API.Response<API.Page<API.PaperList>>>('/api/v1/paper/list', {
    method: 'POST',
    data: params,
  },);
}

export async function questionList(paperId: number) {
  return request<API.Response<API.Question[]>>('/api/v1/paper/listQuestion', {
    method: 'POST',
    data: {paperId,},
  },);
}


export async function addPaper360(params: API.AddPaper360Param) {
  return request<API.Response<API.Paper360[]>>('/api/v1/paper/addPaper360', {
    method: 'POST',
    data: params,
    requestType: 'json'
  },);
}

export async function paper360List(paperId: number) {
  return request<API.Response<API.Paper360[]>>('/api/v1/paper/listPaper360', {
    method: 'POST',
    data: {paperId,},
  },);
}

export async function result(paperId: number, targetId: number) {
  return request<API.Response<API.PaperResult>>('/api/v1/paper/result', {
    method: 'POST',
    data: {paperId, targetId},
  },);
}

export async function exportResult(paperId: number, targetId: number, type: number) {
  if (type === 1) {
    return request<API.Response<API.PaperResult>>('/api/v1/paper/exportResult1', {
      method: 'POST',
      data: {paperId, targetId},
      responseType: 'blob',
      skipErrorHandler: true
    },);
  } else {
    return request<API.Response<API.PaperResult>>('/api/v1/paper/exportResult2', {
      method: 'POST',
      data: {paperId, targetId},
      responseType: 'blob',
      skipErrorHandler: true
    },);
  }
}

export async function exportPaper360(paperId: number) {
  return request<API.Response<API.PaperResult>>('/api/v1/paper/exportPaper360', {
    method: 'POST',
    data: {paperId},
    responseType: 'blob',
    skipErrorHandler: true
  },);
}

export async function deletePaper(pagerId: number) {
  return request<API.Response<any>>('/api/v1/paper/delete', {
    method: 'POST',
    data: {pagerId,}
  });
}

export async function deleteQuestion(paperId: number, questionId: number) {
  return request<API.Response<any>>('/api/v1/paper/removeQuestion', {
    method: 'POST',
    data: {paperId, questionId,}
  });
}

export async function sendEmail(paperId: number, sourceId: number) {
  return request<API.Response<any>>('/api/v1/paper/resendEmail', {
    method: 'POST',
    data: {paperId, sourceId}
  });
}

export async function deleteTarget(paperId: number, targetId: number) {
  return request<API.Response<any>>('/api/v1/paper/deleteTarget', {
    method: 'POST',
    data: {paperId, targetId}
  });
}

export async function deleteSource(paperId: number, sourceId: number) {
  return request<API.Response<any>>('/api/v1/paper/deleteSource', {
    method: 'POST',
    data: {paperId, sourceId}
  });
}

export async function targetAddUser(param: API.TargetAddUserParams) {
  return request<API.Response<any>>('/api/v1/paper/targetAddUser', {
    method: 'POST',
    data: param
  });
}

export async function addQuestion(params: API.AddQuestionParams,) {
  return request<API.Response<any>>('/api/v1/paper/addQuestion', {
    method: 'POST',
    data: params,
    requestType: 'json'
  });
}

export async function updateQuestion(params: API.UpdateQuestionParams,) {
  return request<API.Response<any>>('/api/v1/paper/updateQuestion', {
    method: 'POST',
    data: params,
    requestType: 'json'
  });
}

export async function stopPaper(pagerId: number) {
  return request<API.Response<any>>('/api/v1/paper/stop', {
    method: 'POST',
    data: {pagerId,}
  });
}

export async function restartPaper(pagerId: number) {
  return request<API.Response<any>>('/api/v1/paper/restart', {
    method: 'POST',
    data: {pagerId,}
  });
}

export async function addPaper(params: API.AddPaperParams) {
  return request<API.Response<any>>('/api/v1/paper/add', {
    method: 'POST',
    data: params
  });
}

export async function updatePaper(params: API.UpdatePaperParams) {
  return request<API.Response<any>>('/api/v1/paper/update', {
    method: 'POST',
    data: params
  });
}




