import {Outlet} from "react-router-dom";
import './AdminRoot.css'
import {LoadingProvider} from "../../hooks/useLoading.jsx";
import {MemberList} from "../MemberList.jsx";
import {MemberPage} from "./member/MemberPage.jsx";
import {NewMemberPage} from "./member/NewMemberPage.jsx";
import {ClubList} from "./club/ClubList.jsx";
import {AffiliationReqPage} from "./affiliation/AffiliationReqPage.jsx";
import {NewClubPage} from "./club/NewClubPage.jsx";
import {ClubPage} from "./club/ClubPage.jsx";
import {AffiliationReqList} from "./affiliation/AffiliationReqList.jsx";
import {StatsPage} from "./StatsPage.jsx";
import {PayAndValidateList} from "../PayAndValidateList.jsx";
import {useTranslation} from "react-i18next";

export function AdminRoot() {
    const {t} = useTranslation();
    return <>
        <h1>{t('espaceAdministration')}</h1>
        <LoadingProvider>
            <Outlet/>
        </LoadingProvider>
    </>
}

export function getAdminChildren() {
    return [
        {
            path: 'member',
            element: <MemberList source="admin"/>
        },
        {
            path: 'member/:id',
            element: <MemberPage/>
        },
        {
            path: 'member/new',
            element: <NewMemberPage/>
        },
        {
            path: 'member/validate',
            element: <PayAndValidateList source="admin"/>
        },
        {
            path: 'club',
            element: <ClubList/>
        },
        {
            path: 'club/:id',
            element: <ClubPage/>
        },
        {
            path: 'affiliation/request/:id',
            element: <AffiliationReqPage/>
        },
        {
            path: 'affiliation/request',
            element: <AffiliationReqList/>
        },
        {
            path: 'club/new',
            element: <NewClubPage/>
        },
        {
            path: 'stats',
            element: <StatsPage/>
        }
    ]
}
