/**
 * 奖励内容格式化工具
 */
import i18n from '@/locales/i18n.js'

/**
 * 格式化奖励的展示信息
 * @param {string} type - 奖励类型 (GOLD, DIAMOND, GIFT, FRAGMENTS, DOLLARS 等)
 * @param {object} reward - 奖励对象
 * @returns {string} 格式化后的奖励展示文本
 */
export const formatRewardDisplay = (type, reward) => {
  const showAmountTypes = ['GOLD', 'DIAMOND', 'GIFT', 'FRAGMENTS', 'TICKET']

  if (showAmountTypes.includes(type)) {
    return reward?.content || ''
  } else if (type === 'DOLLARS') {
    return `$${reward?.content}`
  } else {
    // 默认返回数量加天数格式
    return i18n.global.t('reward_days', {
      quantity: reward?.quantity,
    })
  }
}
