"use client"
import { DialogHeader, DialogTitle, DialogFooter, DialogDescription } from "@/components/ui/dialog";
import { Button } from "@/components/ui/button";
import { ComponentProps, useState } from "react";
import { Genre, Story } from "@prisma/client";
import StoryForm from "app/ui/forms/story";
import { StoryWithGenres } from "./page";


export default function EditStoryDialog({ genres, closeDialog, defaults, dbAction }: ComponentProps<"div"> & { genres: Genre[], closeDialog: () => void, defaults: StoryWithGenres, dbAction: (data: Story & { genres: number[] }) => Promise<{ success: string }> }) {


  return (
    <>
      <DialogHeader>
        <DialogTitle>Edit story</DialogTitle>
        <DialogDescription>Create an entry for a new story i.e. a thing you intend to submit for publication.</DialogDescription>
      </DialogHeader>
      <StoryForm dbAction={dbAction} genres={genres} className="" closeDialog={closeDialog} defaults={defaults} />
      <DialogFooter>
        <Button form="storyform">Submit</Button>
      </DialogFooter>
    </>

  )
}

