export default function(_this) {
  return {
    id: 'interview_cjd',
    // title: '成绩单（中/英）',
    title: _this.$t('application.transcript'),
    get: {
      action: `${process.env.baseURL}/api/enrollment/v1.0/application-materials/${process.env.projectId}`,
      callback(data) {
        const { attachments = [], submission_stage: submissionStage = 'FILLING' } = data.data.material
        const stageList = ['FILLING', 'PREPAYMENT', 'INTERVIEW_APPLICATION', 'AUDITION', 'INTERVIEW', 'PAYMENT', 'REGISTRATION', 'CLOSED']
        this.form.options.disabled = stageList.findIndex(item => item === submissionStage) > 2
        return attachments.reduce(
          (result, item) => {
            if (item.file_type_id === 'REPORT_CARD_CN') {
              result.REPORT_CARD_CN.push(item)
            }
            if (item.file_type_id === 'REPORT_CARD_EN') {
              result.REPORT_CARD_EN.push(item)
            }
            return result
          },
          { REPORT_CARD_CN: [], REPORT_CARD_EN: [] }
        )
      }
    },
    form: {
      prev: { to: { query: { active: 'interview_byz' } } },
      next: { to: { query: { active: 'interview_zp' } } },
      hasButton: false,
      options: { 'label-position': 'top' },
      hint: `
      <p>${_this.$t('application.transcriptNote1')}</p>
      <p>${_this.$t('application.transcriptNote2')}</p>
    `,
      items: [
        {
          type: 'v-upload',
          label: _this.$t('application.transcript2'),
          required: true,
          model: 'REPORT_CARD_CN',
          attrs: {
            action: `${process.env.baseURL}/api/enrollment/v1.0/application-materials/attachments/${process.env.projectId}/put`,
            deleteAction: `${process.env.baseURL}/api/enrollment/v1.0/application-materials/attachments/${process.env.projectId}/delete`,
            data: { file_type: 'REPORT_CARD_CN' }
          }
        }
      ]
    }
  }
}
