/**
 * src/routes/events/[event_id]/(leads)/leads/exhibit/[exhibit_id]/+layout.ts
 * Exhibitor Dashboard Loader.
 */
import { browser } from '$app/environment';
import { events_func } from '$lib/ae_events/ae_events_functions';
import { events_slct } from '$lib/stores/ae_events_stores';

export async function load({ params, parent }) {
    const parent_data = await parent();
    const account_id = parent_data.account_id;
    const ae_acct = parent_data[account_id];
    const exhibit_id = params.exhibit_id;

    // Sync to store for components
    events_slct.update((s) => {
        s.exhibit_id = exhibit_id;
        return s;
    });

    if (browser && exhibit_id) {
        events_func.load_ae_obj_id__event_exhibit({
            api_cfg: ae_acct.api,
            exhibit_id: exhibit_id,
            log_lvl: 0
        });

        events_func.load_ae_obj_li__event_exhibit_tracking({
            api_cfg: ae_acct.api,
            exhibit_id: exhibit_id,
            limit: 250,
            log_lvl: 0
        });
    }

    return {};
}
