import http from '@/http'

export const saveDraft = data => http.post('/api/v1/declared/save-to-draft', data)
// 草稿列表java
export const draftList = params => http.get('/api/v1/declared/draft', { params })
// 草稿详情java
export const getDraftDetail = params => http.get(`/api/v1/declared/draft/${params.id}`)
export const getProjectDetail = params => http.get(`/api/v1/project/lib/${params.id}`)
// 项目列表
export const getProjectList = params => http.get('/api/v1/declared/list', { params })// 项目列表java
// 预审申报java
export const preExamineDeclare = data => http.post('/api/v1/prequalification/start', data)
// 项目预审列表java
export const getPreExamineList = params => http.get('/api/v1/prequalification/list', { params })
// 核心业务数据查询java
export const getCoreBusinessData = params => http.get('/api/v1/declared/core-biz', { params })
export const getProjectConfigInfo = params => http.get(`/api/v1/sys/form/${params.regionCode}`)
// 建设方案申报列表java
export const getConstructionDeclarePlan = params => http.get('/api/v1/construction/list', { params })
// 建设方案-申报方案java
export const declareConstructionScheme = data => http.post('/api/v1/construction/start', data)
// 可调整项目列表java
export const projectAdjustmentList = params => http.get('/api/v1/project/adjustment/list', { params })

const exportList = {
  1: '/api/v1/declared/export', // 项目申报导出
  2: '/api/v1/prequalification/export', // 预审项目导出
  3: '/api/v1/construction/export', // 建设方案申报导出
  4: '/api/v1/project/adjustment/export', // 内容调整导出
  5: '/api/v1/project/renewal/exportRenewalDeclare', // 续建项目资金库导出
  6: '/api/v1/declared/purchase/export', // 采购备案导出
  7: '/api/v1/declared/construction/contract/export', // 合同备案导出
  8: '/api/v1/declared/construction/pre-ins/export', // 初验导出
  9: '/api/v1/declared/final-acc/export', // 终验导出
  10: '/api/v1/declared/delayed/export' // 延期项目导出
}
export const declareExport = (state, params) =>
  http.get(exportList[state], { params, responseType: 'blob' }) // 导出列表

const projectStartList = {
  1: '/api/v1/declared/start', // 项目申报-新增
  2: '/api/v1/declared/restart' // 重新申报
}
export const projectStart = (state, data) => http.post(projectStartList[state], data)

export const applicationList = params => http.get('/api/v1/irs/application-list', { params }) // irs应用列表

export const piotTasks = params => http.get('/api/v1/irs/piot-tasks', { params }) // 试点任务列表

export const govStripList = params => http.get('/api/v1/gov-business-strip/list', { params }) // 获取省级条线列表
export const removeProject = (projectCode) => http.post(`/api/v1/declared/remove/${projectCode}`) // 删除项目

