import axios from '@/common/services/axios-instance'

class IamAuditPreparationService {
  // 获取项目信息
  getProjectInfoById(id) {
    return axios({
      url: `api/xcoa-mobile/v1/iamauditproject/getProjectInfoById?id=` + id,
    })
  }

  // 获取被审计单位默认值
  getAuditedUnitById(id) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-material/audit-unit/${id}`,
      method: 'post',
    })
  }

  // 校验下发单位是否已下发过审前资料清单
  checkMaterial(projectId, unitCode, entityId) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-material-list/audit-unit-verify/${projectId}/${unitCode}/${entityId}`,
      method: 'post',
    })
  }

  // 获取导入模板信息
  importMaterialInfo(attachment, projectId) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-material/material-by-template/${attachment}/${projectId}`,
      method: 'post',
    })
  }

  // 获取资料编号
  getMaterialCode(id) {
    return axios({
      url: `api/xcoa-mobile/v1/iam-material/material-code/${id}`,
      method: 'post',
    })
  }

  // 检查是否存在附件
  checkAttachment(attachmentId, beanId, instId, formId) {
    return axios({
      url: `api/xcoa-mobile/v1/attachment-extend/attachments-info-perm/${attachmentId}?formId=${formId}&beanId=${beanId}&instId=${instId}`,
    })
  }

  checkLargeAttachment(attachmentId, beanId, instId, formId) {
    return axios({
      url: `api/framework/v1/large-file/attachments-info-perm/${attachmentId}?formId=${formId}&beanId=${beanId}&instId=${instId}`,
    })
  }
}

export default new IamAuditPreparationService()
