
import {getQualifyExams} from "$lib/data/info"
import type { PageServerLoad } from './$types'
import type {CalendarEvent} from '$lib/components/CalendarEvent'
export const load: PageServerLoad = async () => {
    const exams = await getQualifyExams()
    const events:CalendarEvent[]=[]
    exams.forEach(({id,title,start,institute_id})=>{
        let backgroundColor ="#1111EE"
        switch (institute_id) {
            case 1:
                backgroundColor="#EE1111"
                break;
            case 2:
                backgroundColor="#11EE11"
                break;
            default:
                break;
        }
        const url = "/qualifying/"+id
        events.push({id,title,start,url,backgroundColor})
    })
    return {exams,events}
}

