import { Genre, Pub } from "@prisma/client";
import { getGenres, getPubsWithGenres } from "app/lib/get";
import { columns } from "./columns";
import { DataTable } from "app/ui/tables/data-table";
import CreatePubDialog from "./create";

export type PubsWithGenres = Pub & { genres: Array<Genre> }



export default async function Page() {
  const genres = await getGenres()
  const pubs = await getPubsWithGenres()
  return (
    <div className="container mx-auto">
      <DataTable data={pubs} columns={columns} tableName="pub">
        <CreatePubDialog genres={genres} />
      </DataTable>

    </div>
  )
}
