/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';
import getAuthorList from '../../../../tests/factories/authors/author.factory';

import Author from '.';

const authorData = getAuthorList({})[1];
const reviewerData = getAuthorList({})[1];

export default {
  title: 'Theme/Layout/Author/Multiple Contributors',
  component: Author,
  argTypes: {
    authors: {
      name: 'author',
      type: { name: 'object', required: true },
      defaultValue: [authorData, reviewerData],
      description: 'Author Data',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: 'null' },
      },
    },
    reviewer: {
      name: 'reviewer',
      type: { name: 'object', required: false },
      defaultValue: reviewerData,
      description: 'Reviwer Data',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: 'null' },
      },
    },
    content: {
      name: 'content',
      type: { name: 'element', required: false },
      defaultValue: (
        <div>
          As well as the experience of working within the gambling industry all our contributors are
          casino players themselves. You can read more about our writers and our editorial policy on
          our <a href="/">Meet the Experts page</a> and find out more about Gatsby on our{' '}
          <a href="/">About Us page</a>
        </div>
      ),
      description: 'Hardcoded description at the end',
      table: {
        type: { summary: 'element' },
        defaultValue: { summary: 'null' },
      },
    },
    showAuthorTitle: {
      name: 'showAuthorTitle',
      type: { name: 'boolean', required: false },
      defaultValue: true,
      description: 'Show author title',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: true },
      },
    },
    showReviewerTitle: {
      name: 'showReviewerTitle',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Show reviewer title',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: false },
      },
    },
    showVerification: {
      name: 'showVerification',
      type: { name: 'boolean', required: false },
      defaultValue: true,
      description: 'Show verification badge for reviewer',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: true },
      },
    },
  },
  parameters: {
    docs: {
      description: {
        component:
          'A component that accepts the author info and generates a his/her link name and social icons, used in news cards .',
      },
      page: () => (
        <>
          <Title />
          <Description />
          <Primary />
          <ArgsTable story={PRIMARY_STORY} />
        </>
      ),
    },
  },
};

const Template = (args) => <Author {...args} />;

export const Default = Template.bind({});
Default.args = {};
