"use client";

import { useQuickAdd } from "@/components/quick-add-provider";
import { BangRecordDialog } from "@/components/quick-add/dialogs/bang-record-dialog";
import { CalendarCreateDialog } from "@/components/quick-add/dialogs/calendar-create-dialog";
import { CalendarEventCreateDialog } from "@/components/quick-add/dialogs/calendar-event-create-dialog";
import { ContainerCreateDialog } from "@/components/quick-add/dialogs/container-create-dialog";
import { GardenCareLogDialog } from "@/components/quick-add/dialogs/garden-care-log-dialog";
import { JournalEntryCreateDialog } from "@/components/quick-add/dialogs/journal-entry-create-dialog";
import { ListCreateDialog } from "@/components/quick-add/dialogs/list-create-dialog";
import { ListItemCreateDialog } from "@/components/quick-add/dialogs/list-item-create-dialog";
import { NoteCreateDialog } from "@/components/quick-add/dialogs/note-create-dialog";
import { PlantCreateDialog } from "@/components/quick-add/dialogs/plant-create-dialog";

export function QuickAddCreateHost() {
  const { activeCreateKey, closeCreate } = useQuickAdd();

  const onOpenChange = (next: boolean) => {
    if (!next) closeCreate();
  };

  return (
    <>
      <CalendarEventCreateDialog
        open={activeCreateKey === "calendar.event"}
        onOpenChange={onOpenChange}
      />
      <CalendarCreateDialog
        open={activeCreateKey === "calendar.calendar"}
        onOpenChange={onOpenChange}
      />
      <NoteCreateDialog open={activeCreateKey === "notes.note"} onOpenChange={onOpenChange} />
      <JournalEntryCreateDialog
        open={activeCreateKey === "journal.entry"}
        onOpenChange={onOpenChange}
      />
      <ListItemCreateDialog
        open={activeCreateKey === "lists.add-shopping"}
        onOpenChange={onOpenChange}
        listType="shopping"
      />
      <ListItemCreateDialog
        open={activeCreateKey === "lists.add-task"}
        onOpenChange={onOpenChange}
        listType="task"
      />
      <ListCreateDialog open={activeCreateKey === "lists.new-list"} onOpenChange={onOpenChange} />
      <PlantCreateDialog open={activeCreateKey === "garden.plant"} onOpenChange={onOpenChange} />
      <ContainerCreateDialog
        open={activeCreateKey === "garden.container"}
        onOpenChange={onOpenChange}
      />
      <GardenCareLogDialog
        open={activeCreateKey === "garden.log-care"}
        onOpenChange={onOpenChange}
      />
      <BangRecordDialog open={activeCreateKey === "bangs.record"} onOpenChange={onOpenChange} />
    </>
  );
}
