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

const meta = {
  title: "Elements/OptionSelect/RadioOption",
  component: RadioOption,
  tags: ["autodocs"],
  args: {
    label: "Size",
    options: [
      { label: "Small", value: "s" },
      { label: "Medium", value: "m" },
      { label: "Large", value: "l" },
    ],
  },
  parameters: componentDoc("RadioOption", { barrel: "option-select" }),
} satisfies Meta<typeof RadioOption>

export default meta
type Story = StoryObj<typeof meta>

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

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: "m" },
}

export const WithHelpText: Story = {
  args: { label: "Size", helpText: "Pick a size that fits." },
}

export const WithErrors: Story = {
  args: { label: "Size", errors: ["Please choose a size."] },
}
