import type { Meta, StoryObj } from "@storybook/vue3-vite"
import DropzoneFile from "./DropzoneFile.vue"
import { componentDoc } from "@/lib/storybook"

const meta = {
  title: "Elements/File/DropzoneFile",
  component: DropzoneFile,
  tags: ["autodocs"],
  parameters: componentDoc("DropzoneFile", { barrel: "file" }),
  decorators: [
    () => ({
      template: '<div class="w-96 p-4"><story /></div>',
    }),
  ],
  args: {
    label: "Document",
  },
} satisfies Meta<typeof DropzoneFile>

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {
  args: { label: "Document" },
}

export const PdfsOnly: Story = {
  args: {
    label: "PDF",
    accept: "application/pdf",
    helpText: "PDFs only.",
  },
}

export const Multiple: Story = {
  args: { label: "Documents", multiple: true },
}

export const WithMaxSize: Story = {
  args: {
    label: "Document",
    maxFileSize: 1024 * 1024,
    helpText: "Maximum 1 MB.",
  },
}

export const Required: Story = {
  args: { label: "Document", required: true },
}

export const Disabled: Story = {
  args: { label: "Document", disabled: true },
}

export const WithErrors: Story = {
  args: { label: "Document", errors: ["File is required."] },
}
