import {PageHeader} from "../../../../component/PageHeader.tsx";
import {ListSearchForm} from "../../../../component/ListSearchForm.tsx";
import {BoardListTable} from "../components/BoardListTable.tsx";
import {useLoadingToast} from "../../../../hook/useLoadingToast.ts";
import {Pagination} from "../../../../component/pagination/Pagination.tsx";
import {ActionButtonListGroup} from "../../../../component/button/ActionButtonListGroup.tsx";
import {useBoardListPage} from "../hook/page/useBoardListPage.ts";

export const BoardListPage = () => {
    const {
        header,
        status,
        search,
        table,
        actions,
        pagination,
    } = useBoardListPage();

    useLoadingToast(status);

    return (
        <>
            <PageHeader {...header}/>
            <ListSearchForm
                {...search}
                totalLabel="게시판"
            />
            {status.isLoading && <p>Loading...</p>}

            <BoardListTable {...table}/>
            <ActionButtonListGroup
                {...actions}
                deleteLabel="미사용"
            />
            <Pagination {...pagination}/>
        </>
    )
};
