import {Navigate, Route, Routes} from "react-router-dom";
import {BoardListPage} from "../feature/board/master/page/BoardListPage.tsx";
import {
    ADMIN_AUTHOR_DETAIL_ROUTE, ADMIN_AUTHOR_GROUP_LIST_ROUTE,
    ADMIN_AUTHOR_LIST_ROUTE,
    ADMIN_AUTHOR_ROLE_LIST_ROUTE, ADMIN_BBS_ARTICLE_FORM_ROUTE,
    ADMIN_BBS_MASTER_ROUTE, ADMIN_MENU_CREATE_MANAGE_ROUTE, ADMIN_MENU_POPUP_ROUTE, ADMIN_ROLE_FORM_ROUTE,
    ADMIN_ROLE_LIST_ROUTE
} from "./adminRouteMap.ts";
import {BoardArticleListPage} from "../feature/board/article/page/BoardArticleListPage.tsx";
import {BoardFormPage} from "../feature/board/master/page/BoardFormPage.tsx";
import {AuthorListPage} from "../feature/role/author/page/AuthorListPage.tsx";
import {AuthorRoleListPage} from "../feature/role/authorRole/page/AuthorRoleListPage.tsx";
import {RoleFormPage} from "../feature/role/role/page/RoleFormPage.tsx";
import {AuthorRoleMenuListPage} from "../feature/role/authorRoleMenu/page/AuthorRoleMenuListPage.tsx";
import {AuthorRoleMenuPopupPage} from "../feature/role/authorRoleMenu/page/AuthorRoleMenuPopupPage.tsx";
import {AdminLayout} from "../layout/AdminLayout.tsx";
import {AuthorGroupListPage} from "../feature/role/authorGroup/page/AuthorGroupListPage.tsx";
import {RoleListPage} from "../feature/role/role/page/RoleListPage.tsx";

const ReadyPage = () => {
    return <div>Preparing menu.</div>;
};

export const AdminRoute = () => {
    return (
        <Routes>
            <Route path={`${ADMIN_MENU_POPUP_ROUTE}/:authorCode`} element={<AuthorRoleMenuPopupPage/>}/>

            <Route element={<AdminLayout/>}>
                <Route path="/" element={<Navigate to={ADMIN_BBS_MASTER_ROUTE} replace/>}/>
                <Route path={ADMIN_BBS_MASTER_ROUTE} element={<BoardListPage/>}/>
                <Route path={`/admin/cop/bbs/article/:bbsId`} element={<BoardArticleListPage/>}/>
                <Route path={`${ADMIN_BBS_ARTICLE_FORM_ROUTE}:bbsId`} element={<BoardFormPage/>}/>
                <Route path={ADMIN_BBS_ARTICLE_FORM_ROUTE} element={<BoardFormPage/>}/>

                <Route path={ADMIN_AUTHOR_LIST_ROUTE} element={<AuthorListPage/>}/>
                <Route path={ADMIN_AUTHOR_DETAIL_ROUTE} element={<ReadyPage/>}/>
                <Route path={ADMIN_AUTHOR_ROLE_LIST_ROUTE} element={<AuthorRoleListPage/>}/>
                <Route path={ADMIN_MENU_CREATE_MANAGE_ROUTE} element={<AuthorRoleMenuListPage/>}/>
                <Route path={ADMIN_AUTHOR_GROUP_LIST_ROUTE} element={<AuthorGroupListPage/>}/>
                <Route path={ADMIN_ROLE_LIST_ROUTE} element={<RoleListPage/>}/>
                <Route path={ADMIN_ROLE_FORM_ROUTE} element={<RoleFormPage/>}/>
                <Route path={`${ADMIN_ROLE_FORM_ROUTE}/:roleCode`} element={<RoleFormPage/>}/>
                <Route path="*" element={<ReadyPage/>}/>
            </Route>
        </Routes>
    );
};
