import { Meta } from "@storybook/react";
import { SwitchProps } from "./SwitchProps";
import Switch from "./Switch";

export default {
  title: "Design System/Inputs/Switch",
  component: Switch,
  tags: ["autodocs"],
  parameters: {
    docs: {
      description: {
        component:
          'The KendoReact Switch lets the user toggle between checked and unchecked states. \n\n```javascript\nimport { Switch } from "@renault-ui-library"\n```',
      },
    },
  },
  argTypes: {
    dataTestId: {
      control: { type: "text" },
      description: "Specifies the data-test-id attribute for testing purposes.",
    },
    accessKey: {
      control: { type: "text" },
      description: "Specifies the accessKey of the Switch.",
    },
    ariaDescribedBy: {
      control: { type: "text" },
      description:
        "Identifies the element(s) which will describe the component, similar to HTML aria-describedby attribute.",
    },
    ariaLabel: {
      control: { type: "text" },
      description: "The accessible label of the component.",
    },
    ariaLabelledBy: {
      control: { type: "text" },
      description: "Identifies the element(s) which will label the component.",
    },
    checked: {
      control: { type: "boolean" },
      description: "Sets the current value of the Switch.",
    },
    className: {
      control: { type: "text" },
      description: "Sets the className of the wrapping element of the Switch.",
    },
    defaultChecked: {
      control: { type: "boolean" },
      description:
        "Sets the value of the Switch when it is initially displayed.",
    },
    defaultValue: {
      control: { type: "text" },
      description: "Sets the default value of the Switch.",
    },
    dir: {
      control: { type: "text" },
      description:
        "Sets the dir property of the wrapping element of the Switch.",
    },
    disabled: {
      control: { type: "boolean" },
      description: "Disables the Switch when set to true.",
    },
    id: {
      control: { type: "text" },
      description: "Sets the id of the Switch.",
    },
    name: {
      control: { type: "text" },
      description: "Specifies the name property of the input DOM element.",
    },
    offLabel: {
      control: { type: "text" },
      description: "Changes the Off label.",
    },
    onLabel: {
      control: { type: "text" },
      description: "Changes the On label.",
    },
    required: {
      control: { type: "boolean" },
      description: "Specifies if null is a valid value for the component.",
    },
    size: {
      control: {
        type: "select",
        options: ["null", "small", "medium", "large"],
      },
      description: "Size for the switch",
    },
    tabIndex: {
      control: { type: "number" },
      description: "Specifies the tabIndex of the component.",
    },
    thumbRounded: {
      control: { type: "text" },
      description: "Configures the thumbRounded of the Switch.",
    },
    trackRounded: {
      control: { type: "text" },
      description: "Configures the trackRounded of the Switch.",
    },
    valid: {
      control: { type: "boolean" },
      description: "Overrides the validity state of the component.",
    },
    validationMessage: {
      control: { type: "text" },
      description: "Controls the form error message of the component.",
    },
    validityStyles: {
      control: { type: "boolean" },
      description:
        "If set to false, no visual representation of the invalid state of the component will be applied.",
    },
    value: {
      control: { type: "text" },
      description: "Sets the value of the Switch.",
    },
    onBlur: {
      control: { type: "function" },
      description: "Fires when the Switch is blurred.",
    },
    onChange: {
      control: { type: "function" },
      description: "Fires each time the user selects a new value.",
    },
    onFocus: {
      control: { type: "function" },
      description: "Fires when the Switch is focused.",
    },
  },
} as Meta;

export const Default = (args: SwitchProps): JSX.Element => <Switch {...args} />;

Default.args = {
  dataTestId: "switch-data-testid",
  defaultChecked: true,
};
