import {LoadingProvider} from "../../hooks/useLoading.jsx";
import {Outlet} from "react-router-dom";
import {CompetitionList} from "./CompetitionList.jsx";
import {CompetitionEdit} from "./CompetitionEdit.jsx";
import {CompetitionRegisterAdmin} from "./CompetitionRegisterAdmin.jsx";
import {CompetitionView} from "./CompetitionView.jsx";
import {useTranslation} from "react-i18next";

export function CompetitionRoot() {
    const {t} = useTranslation();
    return <>
        <h1>{t('compétition')}</h1>
        <LoadingProvider>
            <Outlet/>
        </LoadingProvider>
    </>
}

export function getCompetitionChildren() {
    return [
        {
            path: '',
            element: <CompetitionList/>
        },
        {
            path: ':id',
            element: <CompetitionEdit/>
        },
        {
            path: ':id/view',
            element: <CompetitionView/>
        },
        {
            path: ':id/register',
            element: <CompetitionRegisterAdmin source="admin"/>
        },
        {
            path: ':id/club/register',
            element: <CompetitionRegisterAdmin source="club"/>
        }
    ]
}
