import {SelectBoxProps} from "@/components/form/SelectBox";
import {SyncedBook} from "@/lib/types/synced-book";

export function booksToSelectBox(books: SyncedBook[]): SelectBoxProps[] {
    return books.map((book: SyncedBook): SelectBoxProps => {
        return {
            label: book.title,
            value: book.id,
        };
    });
}

export function getBookTypeLabel(value: string): string {
    switch (value) {
        case 'short':
            return 'bookTypes.short';
        case 'novelette':
            return 'bookTypes.novelette';
        case 'long':
            return 'bookTypes.novella';
        case 'chapbook':
            return 'bookTypes.chapbook';
        case 'novel':
            return 'bookTypes.novel';
        default:
            return 'bookTypes.novel';
    }
}
