/* 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 author1Props = {
  pages_count: 6,
  name: 'John Doe', 
  author_review: 'Ice Casino offers an exhilarating gaming experience with its extensive selection of slots and live dealer games, ensuring hours of entertainment for every type of player. The user-friendly interface and generous bonuses make it a standout choice for both new and seasoned online casino enthusiasts.',
  experience: 4,
}

const author2Props = {
  pages_count: 60,
  name: 'Jack Smith', 
  author_review: `Ice Casino stands out for its commitment to player satisfaction, offering a wide array of games and frequent promotions that keep the excitement levels high. The platform's robust security measures and fair play policies ensure a safe and trustworthy environment, making it a top choice for online gaming aficionados.`,
  experience: 10,
}

const reviewerData = getAuthorList({ name: 'Matthew Webb' })[1];

export default {
  title: 'Theme/Modules/Template Blocks/Multiple Contributors',
  component: Author,
  argTypes: {
    authors: {
      name: 'author',
      type: { name: 'object', required: true },
      defaultValue: [getAuthorList({ ...author1Props })[1], getAuthorList({ ...author2Props })[1]],
      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 = {};
