import { api } from '$lib/ae_api/api';
import type { ae_Sponsorship } from '$lib/types/ae_types';
import type { key_val } from '$lib/stores/ae_stores';

/**
 * Sponsorship module logic
 */

export async function load_ae_obj_id__sponsorship({
    api_cfg,
    sponsorship_id,
    log_lvl = 0
}: {
    api_cfg: any;
    sponsorship_id: string;
    log_lvl?: number;
}): Promise<ae_Sponsorship | null> {
    return await api.get_ae_obj({
        api_cfg,
        obj_type: 'sponsorship',
        obj_id: sponsorship_id,
        log_lvl
    });
}

export async function load_ae_obj_li__sponsorship({
    api_cfg,
    for_obj_id,
    log_lvl = 0
}: {
    api_cfg: any;
    for_obj_id: string;
    log_lvl?: number;
}): Promise<ae_Sponsorship[]> {
    return await api.get_ae_obj_li({
        api_cfg,
        obj_type: 'sponsorship',
        for_obj_type: 'account',
        for_obj_id,
        log_lvl
    });
}
