/* eslint-disable import/no-extraneous-dependencies */
import React from 'react';
import {
  Title,
  Description,
  Primary,
  PRIMARY_STORY,
  ArgsTable,
} from '@storybook/addon-docs/blocks';
import { IoOpenOutline } from '@react-icons/all-files/io5/IoOpenOutline';
import getAuthorList from '../../../../tests/factories/authors/author.factory';
import Clock from '~images/icons/clock';
import FactCheckIcon from '~images/icons/fact-check';

import ReviewCredits from '.';

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

export default {
  title: 'Theme/Layout/Author/Review Credits',
  component: ReviewCredits,
  argTypes: {
    authors: {
      name: 'author',
      type: { name: 'object', required: true },
      defaultValue: [authorData],
      description: 'Author Data',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: null },
      },
    },
    authorImageWidth: {
      name: 'authorImageWidth',
      type: { name: 'number', required: false },
      defaultValue: 48,
      description: 'Author/Reviewer image width',
      table: {
        type: { summary: 'number' },
        defaultValue: { summary: 48 },
      },
    },
    authorImageHeight: {
      name: 'authorImageHeight',
      type: { name: 'number', required: false },
      defaultValue: 48,
      description: 'Author/Reviewer image height',
      table: {
        type: { summary: 'number' },
        defaultValue: { summary: 48 },
      },
    },
    clock: {
      name: 'clock',
      type: { name: 'element', required: false },
      defaultValue: <Clock />,
      description: 'Icon for clock',
      table: {
        type: { summary: 'element' },
        defaultValue: { summary: <Clock /> },
      },
    },
    date: {
      name: 'date',
      type: { name: 'date', required: false },
      defaultValue: '2020-04-24 15:37:42',
      description: "The article's publish date.",
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    dateFormat: {
      name: 'dateFormat',
      type: { name: 'string', required: false },
      defaultValue: 'DD.MM.YYYY',
      description: "The date's format.",
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: 'DD.MM.YYYY' },
      },
    },
    editorialIcon: {
      name: 'editorialIcon',
      type: { name: 'element', required: false },
      defaultValue: <IoOpenOutline size={18} />,
      description: 'Icon for Editorial',
      table: {
        type: { summary: 'element' },
        defaultValue: { summary: <IoOpenOutline size={18} /> },
      },
    },
    editorialContent: {
      name: 'editorialContent',
      type: { name: 'element', required: false },
      defaultValue: (
        <div>
          According to our <a href="/">Editorial Guide</a>
        </div>
      ),
      description: 'Text for editorial with link',
      table: {
        type: { summary: 'element' },
        defaultValue: { summary: '' },
      },
    },
    hasAuthorBox: {
      name: 'hasAuthorBox',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description:
        'Check if author box is in the page, if so, then add a link/tab to it (currently hidden)',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: false },
      },
    },
    prefix: {
      name: 'prefix',
      type: { name: 'string', required: false },
      defaultValue: '',
      description: 'Author Prefix',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    readingTime: {
      name: 'readingTime',
      type: { name: 'number', required: false },
      defaultValue: 4,
      description: 'Reading Time',
      table: {
        type: { summary: 'number' },
        defaultValue: { summary: '' },
      },
    },
    reviewer: {
      name: 'reviewer',
      type: { name: 'object', required: false },
      defaultValue: reviewerData,
      description: 'Reviwer Data',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: null },
      },
    },
    showEditorialGuide: {
      name: 'showEditorialGuide',
      type: { name: 'boolean', required: false },
      defaultValue: true,
      description: 'Show the editorial guide',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: true },
      },
    },
    showPrefix: {
      name: 'showPrefix',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Show author/reviewer prefix',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: false },
      },
    },
    showReadingTimeText: {
      name: 'showReadingTimeText',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Show Reading time text',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: false },
      },
    },
    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: true,
      description: 'Show reviewer title',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: true },
      },
    },
    showVerification: {
      name: 'showVerification',
      type: { name: 'boolean', required: false },
      defaultValue: true,
      description: 'Show verification badge for reviewer',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: true },
      },
    },
    splitDateFormat: {
      name: 'splitDateFormat',
      type: { name: 'string', required: false },
      defaultValue: '.',
      description: 'A character to separate day, month and year.',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '.' },
      },
    },
    type: {
      name: 'type',
      type: { name: 'string', required: false },
      defaultValue: 'default',
      description: 'Page template',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    verifyIcon: {
      name: 'verifyIcon',
      type: { name: 'element', required: false },
      defaultValue: <FactCheckIcon width={15} height={15} />,
      description: 'Icon for verify badge',
      table: {
        type: { summary: 'element' },
        defaultValue: { summary: <FactCheckIcon width={15} height={15} /> },
      },
    },
  },
  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) => <ReviewCredits {...args} />;

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