import React from 'react';
// eslint-disable-next-line import/no-extraneous-dependencies
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';
import { siteSchema } from 'gatsby-core-theme/tests/factories/modules/site-schema.factory';
import ContactForm from '.';

const page = {};
siteSchema.email = [
  { email: 'sales@irishluck.ie', contact_type: 'Sales Team' },
  { email: 'support@irishluck.ie', contact_type: 'Support Team' },
  { email: 'contact@irishluck.ie', contact_type: ' General Info' },
];
page.siteSchema = { ...siteSchema };

export default {
  title: 'Theme/Modules/Template Blocks/Contact us page/Site Contacts',
  component: ContactForm,
  argTypes: {
    page: {
      name: 'page',
      type: { name: 'object', required: true },
      defaultValue: '',
      description: 'page object. Get emails list from site schema',
      siteSchema: {
        type: { summary: 'object' },
        defaultValue: { summary: '' },
      },
    },
    showHeading: {
      name: 'showHeading',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Show/hide intro description of page',
    },
    heading: {
      name: 'heading',
      type: { name: 'string', required: false },
      defaultValue: 'Show custom heading here',
      description: 'Show custom heading here',
    },
  },
  parameters: {
    docs: {
      description: {
        component: 'A component that displays authors cards',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

const Template = (args) => <ContactForm {...args} />;
export const Default = Template.bind({});
Default.args = {
  page,
};
