/*
 * 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.runtime.Composable
import org.dueattendant149.bookshelf.presentation.library.model.LibraryLayout
import org.dueattendant149.bookshelf.presentation.library.model.SelectableBook

@Composable
fun LibraryLayout(
    books: List<SelectableBook>,
    layout: LibraryLayout,
    gridSize: Int,
    autoGridSize: Boolean,
    itemContent: @Composable (book: SelectableBook) -> Unit
) {
    when (layout) {
        LibraryLayout.LIST -> {
            LibraryListLayout(
                books = books,
                itemContent = itemContent
            )
        }

        LibraryLayout.GRID -> {
            LibraryGridLayout(
                books = books,
                gridSize = gridSize,
                autoGridSize = autoGridSize,
                itemContent = itemContent
            )
        }
    }
}