/* eslint-disable no-console */
import ModuleValue from '../../../src/constants/module-value';
import { getListContentData } from '~tests/factories/modules/content.factory';
// import { sampleGameCards } from '~tests/factories/modules/card.factory.js';
import { getSpotlightItems } from '~tests/factories/modules/spotlights.factory.js';
import { multiToplistData } from '~tests/factories/modules/toplist.factory.js';

const BonusProps = {
  value: {
    review_link: 'https://www.irishluck.ie/leovegas-casino/',
    rating: '4.8',
    status: 'active',
    logo_url: 'image-38.png',
    url: 'https://www.leovegas.com',
    short_name: 'leovegas',
    name: 'LeoVegas Casino',
  },
  type: 'Bonus',
  module_value_id: 245478,
  name: 'bonus',
};

const archivesProp = {
  items: [
    {
      title: 'title 1',
      content: 'content 1',
      label: 'label-1',
      primary_action: '/primary_action',
      secondary_action: '/secondary_action',
    },
    {
      title: 'title 2',
      content: 'content 2',
      label: 'label-2',
      primary_action: '/primary_action',
      secondary_action: '/secondary_action',
    },
    {
      title: 'title 3',
      content: 'content 3',
      label: 'label-3',
      primary_action: '/primary_action',
      secondary_action: '/secondary_action',
    },
  ],
};

const ProsAndCons = {
  pros: ['TestPro'],
  cons: ['TestCons'],
  module_value_id: 245475,
  name: 'pros_and_cons',
  anchored: 0,
  anchor_label: null,
  anchor_slug: null,
  module_title: null,
  module_title_tag: null,
  background_color: null,
  style: null,
  style_id: null,
  see_more_link: {
    type: 'page',
    value: null,
    title: null,
  },
};

const accordionProps = {
  items: [
    {
      title: 'Test Test',
      content: '<p>This is just a jest</p>',
    },
  ],
  module_value_id: 245476,
  name: 'accordion',
  anchored: 0,
  anchor_label: null,
  anchor_slug: null,
  module_title: null,
  module_title_tag: null,
  background_color: null,
  style: null,
  style_id: null,
  see_more_link: {
    type: 'page',
    value: null,
    title: null,
  },
};

const anchorProps = {
  name: 'anchor',
  module_title: 'Page Contents',
  module_title_tag: 'h2',
  items: [
    {
      label: 'Game Selection',
      type: 'module',
      slug: 'game-selection',
    },
  ],
  module_value_id: 91620,
};

const imageProps = {
  value: 'jumanji-slot-thumbnail.jpg',
  value_object: {
    width: '576',
    height: '576',
    url: 'https://assets-srv.s3.eu-west-1.amazonaws.com/jumanji-slot-thumbnail.jpg',
    filename: 'jumanji-slot-thumbnail.jpg',
  },
  title: 'Tets',
  alignment: 'align_left',
  alt: null,
  module_value_id: 245479,
  name: 'image',
  anchored: 0,
  anchor_label: null,
  anchor_slug: null,
  module_title: null,
  module_title_tag: null,
  background_color: null,
  style: null,
  style_id: null,
  see_more_link: {
    type: 'page',
    value: null,
    title: null,
  },
};

const prefilledModules = [
  {
    module: { name: 'cards_v2', sort_by: 'random' },
    siteName: 'no_site',
    expected: false,
  },
  {
    module: {
      value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
      name: 'cards_v2',
      sort_by: 'random',
    },
    siteName: 'playcasino.co.za',
    expected: false,
  },
  {
    module: {
      value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
      name: 'module',
      sort_by: 'asc',
    },
    siteName: 'playcasino.co.za',
    expected: true,
  },
  {
    module: {
      value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
      name: 'module',
      sort_by: 'random',
    },
    siteName: 'playcasino.co.za',
    expected: true,
  },
  {
    module: {
      value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
      name: 'cards',
      sort_by: 'asc',
    },
    siteName: 'playcasino.co.za',
    expected: true,
  },
  {
    module: {
      value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
      name: 'cards',
      sort_by: 'random',
    },
    siteName: 'playcasino.co.za',
    expected: false,
  },
  {
    module: {
      value_type: ModuleValue.VALUE_TYPE_PREFILLED_MODULE_MARKET,
      name: 'cards_v2',
      sort_by: 'random',
    },
    siteName: 'playcasino.co.za',
    expected: false,
  },
];

// eslint-disable-next-line import/prefer-default-export
export function objectsHolder(elm) {
  if (!elm || elm == null || undefined) {
    return null;
  }
  const data = {
    content: getListContentData(3),
    top_list: multiToplistData,
    archive: archivesProp,
    counter: [],
    pros_and_cons: ProsAndCons,
    accordion: accordionProps,
    anchor: anchorProps,
    bonus: BonusProps,
    image: imageProps,
    spotlights: getSpotlightItems(2),
    prefilledModules: prefilledModules,
  };
  return data[elm];
}
