import { type Book } from './Book';
import { setTimeout } from 'node:timers/promises';

type Props = {
  bookId: string;
};

async function getBookDetails(bookId: string): Promise<Book> {
  await setTimeout(1_000);
  return {
    id: parseInt(bookId, 10),
    title: 'JavaScript - das umfassende Handbuch',
    author: 'Philip Ackermann',
    isbn: '978-3836286299',
    favorite: true,
  };
}
const BookDetails: React.FC<Props> = async ({ bookId }) => {
  const book = await getBookDetails(bookId);
  return (
    <div>
      <h2>{book.title}</h2>
      <p>Author: {book.author}</p>
      <p>ISBN: {book.isbn}</p>
    </div>
  );
};

export default BookDetails;
