import { Book } from '@/books/Book';
import { NextPage } from 'next/dist/types';
import Link from 'next/link';

type Props = {
  params: Promise<{
    id: string;
  }>;
};

async function getBook(id: string): Promise<Book> {
  throw new Error('Server not available');
}

const BookDetailPage: NextPage<Props> = async ({ params }) => {
  const { id } = await params;

  const book = await getBook(id);

  return (
    <div>
      <h1>{book.title}</h1>
      <p>Autor: {book.author}</p>
      <p>ISBN: {book.isbn}</p>
      <Link href="/books">Zurück zur Übersicht</Link>
    </div>
  );
};

export default BookDetailPage;
