import { type AnyDocument } from "@/lib/types";
import { LocationEditForm } from "./location/LocationEditForm";
import { MonsterEditForm } from "./monsters/MonsterEditForm";
import { NpcEditForm } from "./npc/NpcEditForm";
import { SceneEditForm } from "./scene/SceneEditForm";
import { SecretEditForm } from "./secret/SecretEditForm";
import { SessionEditForm } from "./session/SessionEditForm";
import { TreasureEditForm } from "./treasure/TreasureEditForm";

/**
 * Renders a form for any document type depending on the relationship.
 */
export const DocumentEditForm = ({ document }: { document: AnyDocument }) => {
  switch (document.type) {
    case "location":
      return <LocationEditForm location={document} />;
    case "monster":
      return <MonsterEditForm monster={document} />;
    case "npc":
      return <NpcEditForm npc={document} />;
    case "scene":
      return <SceneEditForm scene={document} />;
    case "secret":
      return <SecretEditForm secret={document} />;
    case "session":
      return <SessionEditForm session={document} />;
    case "treasure":
      return <TreasureEditForm treasure={document} />;
  }
};
