/**
 * 网卡状态配置
 */

import { CardStatus } from '@/types/api'
import type { ComponentSize } from 'element-plus'

// 网卡状态选项
export const CARD_STATUS_OPTIONS = [
  {
    label: '激活',
    value: CardStatus.ACTIVATED,
    type: 'success' as const,
    color: '#67C23A'
  },
  {
    label: '停用',
    value: CardStatus.DEACTIVATED,
    type: 'danger' as const,
    color: '#F56C6C'
  },
  {
    label: '测试',
    value: CardStatus.TESTING,
    type: 'warning' as const,
    color: '#E6A23C'
  },
  {
    label: '库存',
    value: CardStatus.INVENTORY,
    type: 'info' as const,
    color: '#909399'
  },
  {
    label: '停机',
    value: CardStatus.SUSPENDED,
    type: 'danger' as const,
    color: '#F56C6C'
  },
  {
    label: '已过期',
    value: CardStatus.EXPIRED,
    type: 'info' as const,
    color: '#909399'
  }
]

// 网卡状态映射
export const CARD_STATUS_MAP = CARD_STATUS_OPTIONS.reduce(
  (map, item) => {
    map[item.value] = item
    return map
  },
  {} as Record<
    CardStatus,
    {
      label: string
      value: CardStatus
      type: 'success' | 'warning' | 'danger' | 'info'
      color: string
    }
  >
)

// 获取网卡状态标签
export function getCardStatusLabel(status: CardStatus): string {
  return CARD_STATUS_MAP[status]?.label || '未知'
}

// 获取网卡状态类型（用于 ElTag）
export function getCardStatusType(status: CardStatus) {
  return CARD_STATUS_MAP[status]?.type || 'info'
}

// 获取网卡状态颜色
export function getCardStatusColor(status: CardStatus): string {
  return CARD_STATUS_MAP[status]?.color || '#909399'
}

// 网络类型选项
export const NETWORK_TYPE_OPTIONS = [
  { label: '2G', value: '2G' },
  { label: '3G', value: '3G' },
  { label: '4G', value: '4G' },
  { label: '5G', value: '5G' },
  { label: 'NB-IoT', value: 'NB-IoT' }
]

// 卡类型选项
export const CARD_TYPE_OPTIONS = [
  { label: '月卡', value: 'monthly' },
  { label: '年卡', value: 'annual' },
  { label: '流量卡', value: 'flow' }
]
