package net.sergeych.toread

import net.sergeych.toread.storage.BookReadingStatus
import kotlin.test.Test
import kotlin.test.assertEquals

class LibraryScreenItemListTest {
    @Test
    fun myLibraryShowsAllBooksExceptNotInterested() {
        val items = listOf(
            libraryItem("file-reading", "Reading", BookReadingStatus.READING),
            libraryItem("file-to-read", "To Read", BookReadingStatus.TO_READ),
            libraryItem("file-read", "Read", BookReadingStatus.READ),
            libraryItem("file-new", "New", BookReadingStatus.NEW),
            libraryItem("file-not-interested", "Not Interested", BookReadingStatus.NOT_INTERESTED),
        )

        val filtered = items.myLibraryItems()

        assertEquals(
            listOf("file-new", "file-read", "file-reading", "file-to-read"),
            filtered.map { it.fileId },
        )
    }

    private fun libraryItem(
        fileId: String,
        title: String,
        readingStatus: BookReadingStatus = BookReadingStatus.NEW,
    ): LibraryItem =
        LibraryItem(
            fileId = fileId,
            bookId = "book-$fileId",
            title = title,
            format = "fb2",
            sizeBytes = null,
            storageUri = null,
            lastSeenAt = null,
            readingStatus = readingStatus,
        )
}
