<!-- eslint-disable vue/no-v-html -->
<template>
  <div class="answerquestion-preview">
    <div class="stem">
      <span class="question-number">{{ data.property.question_number }}.</span>
      <span v-html="sanitizeHTML(data.stem)"></span>
    </div>

    <AudioPlay v-if="data.file_id_list.length > 0" :file-id="data.file_id_list[0]" />

    <SoundRecordPreview :wav-blob.sync="answer.answer_list[0].audio_file_id" />
    <div v-if="isEnable(data.property.is_enable_reference_answer)" class="reference-box">
      <h5 class="reference-title">参考答案</h5>
      <span class="reference-answer" v-html="sanitizeHTML(data.reference_answer)"></span>
    </div>
  </div>
</template>

<script>
import PreviewMixin from './components/PreviewMixin';
import SoundRecordPreview from './components/common/SoundRecordPreview.vue';

export default {
  name: 'AnswerQuestionPreview',
  components: {
    SoundRecordPreview,
  },
  mixins: [PreviewMixin],
  created() {
    this.$set(this.answer.answer_list, 0, { audio_file_id: '' });
  },
  methods: {},
};
</script>

<style lang="scss" scoped>
@use '@/styles/mixin.scss' as *;

.answerquestion-preview {
  @include preview;

  :deep .sound-record-wrapper {
    justify-content: center;
  }

  .reference-box {
    padding: 12px;
    background: #f9f8f9;

    .reference-title {
      margin: 0 0 10px;
      font-size: 14px;
      font-weight: 400;
      line-height: 32px;
      color: #4e5969;
    }
  }
}
</style>
