<script setup lang="ts">
const myModal = useTemplateRef('myModal');

onMounted(() => {
  myModal.value?.showModal();
});

defineEmits(['again', 'home']);
</script>

<template>
  <dialog
    ref="myModal"
    class="flex justify-center items-center backdrop-blur-sm modal"
  >
    <div class="flex flex-col p-3 bg-base rounded-md gap-3 modal-box min-w-fit">
      <h1 class="text-[1.5rem]">
        <slot name="title" />
      </h1>
      <div class="*:inline">
        {{ $t('categoryWord') }}: <slot name="category" />
      </div>
      <div class="*:inline">
        {{ $t('points') }}: <slot name="points" /> / 74
      </div>
      <div class="*:inline">
        {{ $t('result') }}: <slot name="resultTrueFalse" />
      </div>
      <div class="flex flex-row gap-2">
        <div class="btn btn-soft" @click="$emit('home')">
          {{ $t('goBackToHomePage') }}
        </div>
        <div class="btn btn-outline" @click="$emit('again')">
          {{ $t('startAgain') }}
        </div>
        <button class="btn btn-neutral" @click="myModal?.close()">
          {{ $t('viewAnswers') }}
        </button>
      </div>
    </div>
  </dialog>
</template>
