/**
 * @name getSpotlightItem
 * @description Mock Spotlight data with specific id
 * @param {number} id
 * @return {Object} with title "Spotlight item n"
 */
export function getSpotlightItem(id = 1) {
  const item = {
    icon: `icon${id}.png`,
    image: `image${id}.jpg`,
    label: `label ${id}`,
    link: {
      title: null,
      type: id % 2 === 0 ? 'external' : 'internal',
      value: `/link_${id}`,
    },
    link_text: id % 2 === 0 ? 'see all' : '',
    text: `<p>html text ${id}</p>`,
  };

  return item;
}

/**
 * @name getSpotlightItems
 * @description Mock data for test Spotlights components with list of Spotlight items
 * @param {number} totalItems amount of Spotlights on the list
 * @return {Object} with the module containing items or Spotlight objects
 */
export function getSpotlightItems(
  totalItems = 1,
  mode = 'image_text',
  read_more_text = '<p>read more text</p>',
  show_read_more = '1'
) {
  const module = {
    mode,
    read_more_text,
    show_read_more,
    items: [],
    style: 'template_2',
  };
  for (let i = 1; i <= totalItems; i += 1) {
    const item = getSpotlightItem(i);
    module.items.push(item);
  }

  return module;
}
