import {
  formatDate,
  generateRtp,
  generateVolatility,
  generateYesorNo,
  formatGameDate,
  generateLicenseAndSupportTypes,
  generateLink,
  latestItems,
  isLiveCasino,
  getCurrencies,
  getMaxWin,
  getMaxStake,
  // getExperience, // Note: to be used later
} from '../helpers/info-grid';

export const defaultInfoGrid = {
  operator_review: {
    website: [
      '',
      '🏠 Website',
      (value, props) =>
        generateLink(value, {
          ...props,
          type: 'url',
          showTracker: true,
          newTab: true,
          addRel: true,
        }),
    ],
    email: [
      'email',
      '📧 Email',
      (value, props) => generateLink(value, { ...props, type: 'email', newTab: true }),
    ],
    currencies: [
      'bonus.currencies',
      '💵 Accepted Currencies',
      (value, props) => latestItems(value, props, 5),
    ],
    deposit_methods: [
      'bonus.deposit_methods',
      'Payment Methods',
      (value, props) => latestItems(value, { ...props, showMore: true, tooltip: false }, 2),
    ],
    launch_date: ['launch_date', 'Release Date'],
    licenses: [
      'bonus.license_objects',
      '✅  License',
      (value, props) => latestItems(value, props, 3),
    ],
    no_games: ['bonus.games_amount || games_amount', 'No. of Games'],
    game_providers: [
      'software',
      'Software',
      (value, props) =>
        latestItems(
          value,
          {
            ...props,
            showMore: true,
            tooltip: true,
            customValue: { translationKey: 'see_more', label: 'see more' },
          },
          5
        ),
    ],
  },
  game_review: {
    launch_date: ['launch_date', 'Launched'],
    rtp: ['rtp', 'Repayment percentage', (value) => generateRtp(value)],
    volatility: ['volatility', 'Volatility', (value, props) => generateVolatility(value, props)],
    max_win: [
      'affiliate_games[market].extra_fields.max_win',
      'Max Profit',
      (value) => getMaxWin(value),
    ],
    freespins: ['freespins', 'Free spins', (value, props) => generateYesorNo(value, props)],
    number_of_reels: ['number_of_reels', 'Wheels'],
    winning_lines: ['winning_lines', 'Paylines'],
    stake: ['affiliate_games[market].extra_fields.stake', 'Effort', (value) => getMaxStake(value)],
    bonus_features: ['affiliate_games[market].extra_fields.bonus_features', 'Bonus features'],
  },
  authors: {
    university: ['university', 'Alumni Of'],
    degree: ['degree', 'Degree'],
    pronouns: ['pronouns', 'Pronouns'],
    email_address: [
      'email_address',
      'Email Address',
      (value, props) => generateLink(value, { ...props, type: 'email', newTab: true }),
    ],
    lives_in: ['lives_in', 'Lives In'],
    articles_written: ['pages_count', 'Articles Written'],
    // experience: ['experience', 'Experience', (value, props) => getExperience(value, { ...props, text: 'Years' })] // Note: Use this fn to get experience and pass custom text
  },
};

export const twoColInfoGrid = {
  operator_review: {
    info: {
      founded: ['founded', '🏠 Launched', (value) => formatDate(value)],
      owner: ['owner', '✅ Owner'],
      licenses: [
        'bonus.licenses',
        '🎮 License',
        (value) => generateLicenseAndSupportTypes(value, null, 3),
      ],
      support_types: [
        'support_types',
        '✅ Support Types',
        (value) => generateLicenseAndSupportTypes(value, null, 3),
      ],
      email: [
        'email',
        '📧 Email',
        (value, props) => generateLink(value, { ...props, type: 'email', newTab: true }),
      ],
    },
    details: {
      software: [
        'software',
        '🎮 Game Providers',
        (value, props) =>
          latestItems(
            value,
            {
              ...props,
              showMore: true,
              tooltip: false,
              customValue: { translationKey: 'see_all', label: 'See all' },
            },
            5
          ),
      ],
      live_casinos: ['types', '🎲 Live Casino', (value) => isLiveCasino(value)],
      games_amount: ['games_amount', '🎮 Number of Games/Slots'],
      categories: ['game', '🎲 Game Categories'],
      currencies: [
        'bonus.currencies',
        '💵 Accepted Currencies',
        (value, props) => latestItems(value, props, 5),
      ],
      deposit_methods: [
        'bonus.deposit_methods',
        '💵 Payment Methods',
        (value, props) => latestItems(value, props, 5),
      ],
    },
  },
  sportsbook_review: {
    info: {
      founded: ['founded', 'Operating Since', (value) => formatDate(value)],
      owner: ['owner', 'Company'],
      licenses: [
        'bonus.licenses',
        'License',
        (value) => generateLicenseAndSupportTypes(value, null, 3),
      ],
      support_types: [
        'support_types',
        'Support Types',
        (value) => generateLicenseAndSupportTypes(value, null, 3),
      ],
      email: [
        'email',
        'Email',
        (value, props) => generateLink(value, { ...props, type: 'email', newTab: true }),
      ],
      currencies: [
        'bonus.currencies',
        'Accepted Currencies',
        (value) => getCurrencies(value, null, 5),
      ],
    },
    details: {
      software: ['software', 'Live Games', (value, props) => generateYesorNo(value, props)],
      deposit_methods: [
        'bonus.deposit_methods',
        'Payment Methods',
        (value, props) =>
          latestItems(
            value,
            {
              ...props,
              showMore: true,
              tooltip: true,
              customValue: { translationKey: 'see_all', label: 'See all' },
            },
            5
          ),
      ],
    },
  },
  game_review: {
    info: {
      launch_date: ['launch_date', 'Launched', (value) => formatGameDate(value)],
      rtp: ['rtp', 'RTP', (value) => generateRtp(value)],
    },
    details: {
      volatility: ['volatility', 'Volatility', (value, props) => generateVolatility(value, props)],
      respins: ['freespins', 'Freespins', (value, props) => generateYesorNo(value, props)],
      jackpot: ['jackpots', 'Jackpot', (value, props) => generateYesorNo(value, props)],
      winning_lines: ['winning_lines', 'Paylines'],
      number_of_reels: ['number_of_reels', 'Wheels/Reels'],
    },
  },
};
