/*
 * Book's Story — free and open-source Material You eBook reader.
 * Copyright (C) 2024-2026 Acclorite
 * SPDX-License-Identifier: GPL-3.0-only
 */

package org.dueattendant149.bookshelf.ui.library

import androidx.compose.foundation.pager.PagerState
import androidx.compose.runtime.Composable
import org.dueattendant149.bookshelf.core.BottomSheet
import org.dueattendant149.bookshelf.domain.model.library.Category
import org.dueattendant149.bookshelf.presentation.library.LibraryEvent
import org.dueattendant149.bookshelf.presentation.library.LibraryScreen
import org.dueattendant149.bookshelf.presentation.library.model.LibrarySortOrder
import org.dueattendant149.bookshelf.presentation.settings.SettingsEvent

@Composable
fun LibraryBottomSheet(
    bottomSheet: BottomSheet?,
    categories: List<Category>,
    showDefaultCategory: Boolean,
    pagerState: PagerState,
    sortOrder: LibrarySortOrder,
    sortOrderDescending: Boolean,
    perCategorySort: Boolean,
    changeSortOrder: (LibrarySortOrder) -> Unit,
    changeSortOrderDescending: (Boolean) -> Unit,
    updateCategory: (SettingsEvent.OnUpdateCategory) -> Unit,
    dismissBottomSheet: (LibraryEvent.OnDismissBottomSheet) -> Unit
) {
    when (bottomSheet) {
        LibraryScreen.FILTER_BOTTOM_SHEET -> {
            LibraryFilterBottomSheet(
                categories = categories,
                showDefaultCategory = showDefaultCategory,
                categoriesPagerState = pagerState,
                sortOrder = sortOrder,
                sortOrderDescending = sortOrderDescending,
                perCategorySort = perCategorySort,
                changeSortOrder = changeSortOrder,
                changeSortOrderDescending = changeSortOrderDescending,
                updateCategory = updateCategory,
                dismissBottomSheet = dismissBottomSheet
            )
        }
    }
}