/* eslint-disable react-hooks/rules-of-hooks */
import React, {useState} from 'react';
import {Meta, StoryObj} from '@storybook/react';

import {InputOTP} from './index';

const meta: Meta<typeof InputOTP> = {
  title: 'HuGo/Inputs/InputOTP',
  component: InputOTP,
  argTypes: {
    label: {type: 'string'},
    helper: {type: 'string'},
    disabled: {type: 'boolean'},
    isError: {type: 'boolean'},
    isSuccess: {type: 'boolean'},
    size: {control: 'radio', options: ['sm', 'md']},
    type: {control: 'radio', options: ['default', 'password', 'custom']},
  },
};

type Story = StoryObj<typeof InputOTP>;

export const InputOTPComponent: Story = {
  args: {
    label: 'Label',
    helper: 'Helper',
    disabled: false,
    isError: false,
    isSuccess: false,
    length: 'md',
    type: 'default',
  },
  render: args => {
    const [value, setValue] = useState('');
    return <InputOTP value={value} onChangeText={setValue} {...args} />;
  },
};

export default meta;
