/* 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 authorShip from '../../../../storybook-images/authorship.svg';
import clock from '../../../../storybook-images/clock.svg';
import verifyIcon from '../../../../storybook-images/verifiedAuthor.svg';

import Author from '.';

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

export default {
  title: 'Theme/Layout/Author/Review Credits',
  component: Author,
  argTypes: {
    author: {
      name: 'author',
      type: { name: 'object', required: true },
      defaultValue: authorData,
      description: 'Author Data',
      table: {
        type: { summary: 'object' },
        defaultValue: { summary: '' },
      },
    },
    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 },
      },
    },
    buttonIcon: {
      name: 'buttonIcon',
      type: { name: 'string', required: false },
      defaultValue: authorShip,
      description: 'Icon for contributors',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: authorShip },
      },
    },
    clock: {
      name: 'clock',
      type: { name: 'string', required: false },
      defaultValue: clock,
      description: 'Icon for clock',
      table: {
        type: { summary: 'string' },
        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} /> },
      },
    },
    editorialLink: {
      name: 'editorialLink',
      type: { name: 'string', required: false },
      defaultValue: '/about-us',
      description: 'Link for Editorial',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    editorialLinkText: {
      name: 'editorialLinkText',
      type: { name: 'string', required: false },
      defaultValue: 'Editorial Guide',
      description: 'Text for editorial link',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '' },
      },
    },
    editorialText: {
      name: 'editorialText',
      type: { name: 'string', required: false },
      defaultValue: 'According to our',
      description: 'Text for editorial',
      table: {
        type: { summary: 'string' },
        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 },
      },
    },
    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: reviewerData },
      },
    },
    showEditorialGuide: {
      name: 'showEditorialGuide',
      type: { name: 'boolean', required: false },
      defaultValue: true,
      description: 'Show the editorial guide',
      table: {
        type: { summary: 'boolean' },
        defaultValue: { summary: true },
      },
    },
    showReadingTimeText: {
      name: 'showReadingTimeText',
      type: { name: 'boolean', required: false },
      defaultValue: false,
      description: 'Show Reading time text',
      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 },
      },
    },
    splitDateFormat: {
      name: 'splitDateFormat',
      type: { name: 'string', required: false },
      defaultValue: '.',
      description: 'A character to separate day, month and year.',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: '.' },
      },
    },
    verifyIcon: {
      name: 'verifyIcon',
      type: { name: 'string', required: false },
      defaultValue: verifyIcon,
      description: 'Icon for verify badge',
      table: {
        type: { summary: 'string' },
        defaultValue: { summary: verifyIcon },
      },
    },
  },
  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 = {};
