// 获取彩种名称 (1-13)
export const getLotteryGameName = (typeCode, t) => {
    const map = {
        1: t('新澳门六合彩'),
        2: t('香港六合彩'),
        3: t('澳门六合彩'),
        4: t('极速六合彩'),
        5: t('加拿大28'),
        6: t('极速28'),
        7: t('极速赛车'),
        8: t('极速时时彩'),
        9: t('极速飞艇'),
        10: t('SG时时彩'),
        11: t('SG飞艇'),
        12: t('极速快3'),
        13: t('SG快3')
    };
    return map[Number(typeCode)] || t('未知类型');
};

// 获取彩种大类标签颜色
export const getLotteryTypeTag = (typeCode) => {
    const tNum = Number(typeCode);
    if (tNum >= 1 && tNum <= 4) return 'success'; // 六合彩
    if (tNum >= 5 && tNum <= 6) return 'primary'; // PC28
    return 'warning'; // 极速系列
};

// 判断是否为快3系列
export const isKuai3 = (typeCode) => {
    return [12, 13].includes(Number(typeCode));
};

// 判断是否为六合彩系列
export const isLhc = (typeCode) => {
    return [1, 2, 3, 4].includes(Number(typeCode));
};

// 六合彩波色计算
export const getLhcBallColorClass = (numStr) => {
    const num = parseInt(numStr, 10);
    if (isNaN(num)) return 'bg-gray';

    const reds = [1, 2, 7, 8, 12, 13, 18, 19, 23, 24, 29, 30, 34, 35, 40, 45, 46];
    const blues = [3, 4, 9, 10, 14, 15, 20, 25, 26, 31, 36, 37, 41, 42, 47, 48];
    const greens = [5, 6, 11, 16, 17, 21, 22, 27, 28, 32, 33, 38, 39, 43, 44, 49];

    if (reds.includes(num)) return 'bg-red';
    if (blues.includes(num)) return 'bg-blue';
    if (greens.includes(num)) return 'bg-green';

    return 'bg-gray';
};

// 极速系列球色计算
export const getJisuBallColorClass = (numStr, typeCode) => {
    if (!numStr) return '';
    const tNum = Number(typeCode);

    if ([7, 9, 11].includes(tNum)) {
        const num = parseInt(numStr, 10);
        return `color-${num}`;
    } else if ([8, 10].includes(tNum)) {
        return 'wave-blue';
    }
    return 'wave-blue';
};

// 状态标签配置
export const getLotteryStatusTag = (statusVal, t) => {
    const status = Number(statusVal);
    if (status === 0) return { text: t('未开奖'), type: 'warning' };
    if (status === 1) return { text: t('未中奖'), type: 'danger' };
    if (status === 2) return { text: t('已中奖'), type: 'success' };
    if (status === 3) return { text: t('合局'), type: 'info' };
    if (status === 4) return { text: t('已退款'), type: 'info' };
    return { text: '--', type: 'info' };
};