import React from 'react';
import {Meta, StoryObj} from '@storybook/react';
import Slot from '@components/_HuGo/Slot';

import {Dialog} from './index';

const meta: Meta<typeof Dialog> = {
  title: 'HuGo/Dialog',
  component: Dialog,
  argTypes: {
    isVisible: {control: 'boolean'},
    title: {control: 'text'},
  },
  render: args => (
    <Dialog {...args}>
      <Slot />
    </Dialog>
  ),
};

type Story = StoryObj<typeof Dialog>;

const COMMON_PROPS = {
  isVisible: false,
  title: 'I am a title from Dialog',
};

export const DialogComponent: Story = {
  args: COMMON_PROPS,
};

export const DialogWithFooterComponent: Story = {
  args: {
    footer: {
      primaryButton: {text: 'Button 1', onPress: () => null},
      secondaryButton: {text: 'Button 2', onPress: () => null},
      infoText: 'Additional Text',
    },
    ...COMMON_PROPS,
  },
};

export const DialogCanGoBackComponent: Story = {
  args: {
    ...COMMON_PROPS,
    onGoBack: () => null,
  },
};

export const DialogFullComponent: Story = {
  args: {
    footer: {
      primaryButton: {text: 'Button 1', onPress: () => null},
      secondaryButton: {text: 'Button 2', onPress: () => null},
      infoText: 'Additional Text',
    },
    onGoBack: () => null,
    ...COMMON_PROPS,
  },
};

export default meta;
