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

export type StoryWithGenres = Story & { genres: Array<Genre> }






export default async function Page() {
  const genres = await getGenres()
  const storiesWithGenres: Array<StoryWithGenres> = await getStoriesWithGenres()
  const pubsWithGenres = await getPubsWithGenres()



  return (
    <div className="container mx-auto">
      <DataTable columns={columns} data={storiesWithGenres} type="story">
        <CreateStoryDialog genres={genres} />
      </DataTable>
    </div>
  )
}



