<script>
 import { createEventDispatcher } from 'svelte';

 import CorrectionResponses from './CorrectionResponses.svelte';

 export let question = null;
 export let cts = null;
 export let child = null;
 export let filter = "";
 export let notCorrected = false;
 export let showStudent = false;
 export let templates = [];

 const dispatch = createEventDispatcher();
</script>

{#if question && (question.kind == 'mcq' || question.kind == 'ucq')}
    {#await question.getProposals()}
        <div class="text-center mt-4">
            <div class="spinner-border text-primary mx-3" role="status"></div>
            <span>Récupération des propositions&hellip;</span>
        </div>
    {:then proposals}
        <CorrectionResponses
            {cts}
            bind:this={child}
            {filter}
            {question}
            {notCorrected}
            {proposals}
            {showStudent}
            {templates}
            on:nb_responses={(v) => dispatch('nb_responses', v.detail)}
        />
    {/await}
{:else}
    <CorrectionResponses
        {cts}
        bind:this={child}
        {filter}
        {question}
        {notCorrected}
        {showStudent}
        {templates}
        on:nb_responses={(v) => dispatch('nb_responses', v.detail)}
    />
{/if}
