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

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

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = { args: { label: "Avatar" } }

export const ImagesOnly: Story = {
  args: {
    label: "Avatar",
    accept: "image/*",
    helpText: "PNG or JPG",
  },
}

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

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

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

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

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