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

const props = defineProps<{ node: any }>()

const { getUserAttr } = useUserAttr()

const config = computed(() => {
  return props.node.data.teacher || {}
})

function paramsParse(data: any) {
  return data.rules
}
</script>

<template>
  <RuleTemplate :node="node" step :paramsParse="paramsParse">
    <template #header-answer>
      <p v-for="(item, index) in config.rules" :key="index">
        <span>{{ getUserAttr(item.attr_id)?.name }}</span>
        <span class="is-operate">&nbsp;&nbsp;{{ item.operate }}&nbsp;&nbsp;</span>
        <span class="is-answer">{{ item.value }}</span>
        &nbsp;&nbsp;&nbsp;&nbsp;
      </p>
    </template>
  </RuleTemplate>
</template>
