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

const meta = {
  title: "Elements/OptionSelect/CheckboxOption",
  component: CheckboxOption,
  tags: ["autodocs"],
  args: {
    label: "Preferences",
    options: [
      { label: "Newsletter", value: "news" },
      { label: "SMS", value: "sms" },
      { label: "Push", value: "push" },
    ],
  },
  parameters: componentDoc("CheckboxOption", { barrel: "option-select" }),
} satisfies Meta<typeof CheckboxOption>

export default meta
type Story = StoryObj<typeof meta>

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

export const Inline: Story = {
  args: { label: "Inline", inline: true },
}

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

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

export const Preselected: Story = {
  args: { label: "Preselected", modelValue: ["news"] },
}

export const WithHelpText: Story = {
  args: { label: "Preferences", helpText: "Pick any that apply." },
}

export const WithErrors: Story = {
  args: { label: "Preferences", errors: ["Select at least one."] },
}
