<template>
  <FlexCol gap="gap.lg">
    <EvaluationFormBlock
      ref="blockRef"
      :current-form="currentForm"
      :form-options="formOptions"
      :form-options-end="formOptionsEnd"
      :check-item-list="checkItemList"
      :current-form-check-items="currentFormCheckItems"
      :readonly="readonly"
    />
  </FlexCol>
</template>

<script setup lang="ts">
import { computed, ref } from 'vue';
import type { CheckItemInfo, SelfAssessmentCheckItemAnswer, SelfAssessmentDetail } from '@/api/collect/AssessmentContent';
import type { IDynamicFormOptions } from '@/components/dynamic';
import EvaluationFormBlock from './EvaluationFormBlock.vue';
import FlexCol from '@/components/layout/FlexCol.vue';

const props = withDefaults(defineProps<{
  currentForm: SelfAssessmentDetail;
  formOptions: IDynamicFormOptions;
  formOptionsEnd: IDynamicFormOptions;
  checkItemList: CheckItemInfo[];
  currentFormCheckItems: SelfAssessmentCheckItemAnswer[];
  readonly?: boolean;
}>(), {
  readonly: false,
});

const blockRef = ref<InstanceType<typeof EvaluationFormBlock> | null>(null);

defineExpose({
  validate: () => blockRef.value?.validate(),
});
</script>
