package net.sergeych.toread

internal data class LibraryDeleteRequest(
    val fileId: String,
    val title: String,
)

internal data class LibraryDeleteResult(
    val deleted: Boolean,
    val message: String,
)

internal suspend fun deleteLibraryBook(fileId: String, title: String): LibraryDeleteResult {
    val deleted = runCatching { deleteLibraryItem(fileId) }.getOrDefault(false)
    return LibraryDeleteResult(
        deleted = deleted,
        message = if (deleted) strings.removed(title) else strings.couldNotRemove(title),
    )
}
