<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 || {}
})

const userAttr = computed(() => getUserAttr(config.value.attr_id))

function paramsParse(data: any) {
  return [{ attr_id: data.attr_id, value: data.value, operate: data.operate }]
}
</script>

<template>
  <RuleTemplate :node="node" step :paramsParse="paramsParse">
    <template #header-answer>
      <span class="is-answer">{{ userAttr?.name }} {{ config.operate }} {{ config.value }}</span>
    </template>
  </RuleTemplate>
</template>
