<script setup lang="ts">
import ConfigViewTemplate from '../../ConfigViewTemplate.vue'
import { useConnection } from '../../../composables/useAllData'

const role = inject('role') as string

defineProps<{ node: any }>()

const { connectionList } = useConnection()

const operateList = [{ label: '新用户注册', value: '0' }]

const getConnectionLabel = function (id: string) {
  return connectionList.value.find(item => item.id === id)?.name || ''
}
</script>

<template>
  <ConfigViewTemplate :node="node">
    <el-form-item :label="role === 'student' ? '我的答案' : '学生答案'">
      {{ operateList.find(item => item.value === node.data.student?.operate)?.label || '' }}
      {{ getConnectionLabel(node.data.student?.connection_id) }}
    </el-form-item>
    <el-form-item label="正确答案">
      {{ operateList.find(item => item.value === node.data.teacher?.operate)?.label || '' }}
      {{ getConnectionLabel(node.data.teacher?.connection_id) }}
    </el-form-item>
  </ConfigViewTemplate>
</template>
