/**
 * 运营商配置
 */

import { Operator } from '@/types/api'

// 运营商选项
export const OPERATOR_OPTIONS = [
  { label: '中国移动', value: Operator.CHINA_MOBILE, color: '#4CAF50' },
  { label: '中国联通', value: Operator.CHINA_UNICOM, color: '#2196F3' },
  { label: '中国电信', value: Operator.CHINA_TELECOM, color: '#FF9800' },
  { label: 'GS移动', value: Operator.GS_MOBILE, color: '#4CAF50' },
  { label: 'GS联通', value: Operator.GS_UNICOM, color: '#2196F3' },
  { label: 'GS电信', value: Operator.GS_TELECOM, color: '#FF9800' },
  { label: 'DC物联', value: Operator.DC_IOT, color: '#9C27B0' },
  { label: 'GDWL', value: Operator.GDWL, color: '#F44336' }
]

// 运营商映射
export const OPERATOR_MAP = OPERATOR_OPTIONS.reduce(
  (map, item) => {
    map[item.value] = item
    return map
  },
  {} as Record<Operator, { label: string; value: Operator; color: string }>
)

// 获取运营商标签
export function getOperatorLabel(operator: Operator): string {
  return OPERATOR_MAP[operator]?.label || operator
}

// 获取运营商颜色
export function getOperatorColor(operator: Operator): string {
  return OPERATOR_MAP[operator]?.color || '#666'
}
