<script lang="ts">
    import AudioPlayerComponent from "./AudioPlayerComponent.svelte";
    import type { AudioQuestion } from "./games/games";

    const path = "/sounds/";

    interface Props {
        question: AudioQuestion;
        showAnswer: boolean;
        showQuestion: boolean;
        showPlayer: boolean;
        [key: string]: unknown;
    }

    let { question, showAnswer, showQuestion, showPlayer }: Props = $props();
</script>

<div class="mb-4 flex grow flex-col items-center text-6xl">
    {#if showQuestion || showAnswer}
        <div class="flex grow-1 items-center">
            <div class="text-center">{question.data.question}</div>
        </div>
    {/if}
    {#if showPlayer}
        <div class="flex w-full flex-col justify-center">
            <AudioPlayerComponent src={path + question.data.audio} />
        </div>
    {/if}
    {#if showAnswer}
        <div class="flex grow-1 items-center text-center">
            {question.data.answer}
        </div>
    {/if}
</div>
