import { getActClass as commonGetActClass } from 'press-ui/common/utils/act-bem';

export const TIP_CLASS_MAP = {
  'self-hold': 'toc-selfhosted-bg',
  selection: 'toc-top--selection',
  'selection-button': 'toc-top--selection-btn',
  'selection-button--fast': 'selection-fast',
  'selection-button--big': 'selection-big',
  'hold-main': 'toc-selection--selfhost',
  'common-title': 'tip-toc-commontitle',
  'icon--hold-game': 'ico-tip-40-recommend',
  'hold-empty': 'tip-toc-selfhosted-blank',
  'empty-img': 'tip-toc-selfhosted-img',
  'empty-text': 'tip-toc-selfhosted-text',
  'hold-list': 'tip-toc-list-selfhosted',
  'game-item': 'tip-toc-gamemsg',
  'icon--share': 'tip-toc-icon-share',
  'game-label': 'tip-toc-gamemsg-label',
  'game-label--orange': 'signing-up',
  'game-label--green': 'game-ing',
  'game-label--gray': 'game-end',
  'game-label--blue': 'game-join',
  'game-meta': 'tip-toc-gamemsg-item',
  'game-title': 'gamemsg-title',
  'game-title--link': 'title-link',
  overflow: 't-overflow',

  'label-list': 'gamemsg-label-list',
  'prize-info': 'gamemsg-prizesbar',
  operations: 'tip-toc-opera-btn',

  'gp-button--secondary': 'gp-match-secondary-btn',
  'gp-button--primary': 'gp-match-primary-btn',
  'button-tip': 'gp-match-manual-start-tip',
  services: 'tip-toc-list--services',
};

export function getActClass(useTipClass: boolean, args: any) {
  return commonGetActClass(useTipClass, TIP_CLASS_MAP, args);
}

export const GP_MATCH_COMMON_CLASS_MAP = {
  'button--common': 'tip-toc-commbtn',

  'button--primary': 'tip-btn-primary',
  'button--primary-xs': 'tip-btn-primary-xs',
  'button--primary-m': 'tip-btn-primary-m',
  'button--primary-l': 'tip-btn-primary-l',
  'button--primary-small': 'tip-btn-primary-small',

  'button--default': 'tip-btn-default',
  'button--default-small': 'tip-btn-default-small',

  'button--invalid': 'tip-btn-invalid',
  'button--invalid-m': 'tip-btn-invalid-m',
  'button--invalid-l': 'tip-btn-invalid-l',
  'button--invalid-small': 'tip-btn-invalid-small',

  'button--yellow-small': 'tip-btn-yellow-small',

  'button--disable-l': 'tip-btn-disable-l',

  'button--text-primary': 'tip-textbtn-primary',
  'button--text-cancel': 'tip-textbtn-cancel',
  'button--bottom': 'tip-toc-bottomwrap',
  'button--operation': 'operating-btn-wrap',

  'pop-box-04': 'pop-box04',
  'button-comm-01': 'btn-comm01',

  // common title

  'more-link': 'tip-toc-morelink',
  'right-tips': 'common-right-tips',
  protocol: 'team-protocol',
  'protocol-tips': 'team-protocol-tips',
  'protocol-more': 'team-protocol-more',

  'more-msg': 'team-moremsg',
  'more-msg-text': 'team-moremsg-txt',
  'more-msg-link': 'team-moremsg-link',

  // game-item

  // 'game-list': 'tip-toc-gamemsg-list',
  // 'team-list': 'tip-toc-teamlist',
  // 'team-list-inner': 'tip-toc-teamlist-vanlist',
  // 'game-item--living': 'tip-toc-gamemsg--living',

  // 'game-living': 'tip-toc-living',
  // 'tip-toc-living-none',
  // 'tip-toc-living-icon',
  // 'press__game-label',
  // 'signing-up',
  // 'game-ing',
  // 'game-end',
  // 'game-join',
  // 'gamemsg-img',
  // 'white-title',
  // 'gamemesg-label-location',
  // '': 'no-bold',
  // 'tag-purple': 'tag-purple',
  // 'tag-green': 'tag-green',
  // 'detail-label-list': 'match-detail-label-list',
  // 'info-bar': 'gamemsg-infobar',
  // 'highlight': 'highlight-info',
  // 'label-prize': 'label-prize',
  // 'scroll': 'tip-toc-scroll'
};

// 向前兼容，更换赛事item后需进行数据字段转换
export function convertData(match: any) {
  const statusGaming = 3; // 进行中
  const online = 1; // 线上
  const offline = 2; // 线下
  const endTag = '已结束'; // 已结束
  return {
    ...match,
    showLiving: match.dispStatus === statusGaming,
    showShare: true,
    tagText: match.tag || '',
    gameName: match.name || '',
    matchStartDesc: match.timeDesc || '',
    gameTag: match.locationDesc || '',
    isOnline: match.match_rule_cfg?.pubg_rule_cfg?.online === online || false,
    isOffline: match.match_rule_cfg?.pubg_rule_cfg?.online === offline || false,
    prizeDesc: match.prizeName || '',
    showOperations: match.tag !== endTag,
  };
}
