export const coinRangeOptions = [
  { label: '全部区间', min: undefined, max: undefined },
  { label: '0-100', min: 0, max: 100 },
  { label: '100-300', min: 100, max: 300 },
  { label: '300-500', min: 300, max: 500 },
  { label: '500+', min: 500, max: undefined },
]

export const moneyRangeOptions = [
  { label: '全部区间', min: undefined, max: undefined },
  { label: '0-50', min: 0, max: 50 },
  { label: '50-100', min: 50, max: 100 },
  { label: '100-200', min: 100, max: 200 },
  { label: '200+', min: 200, max: undefined },
]

export const totalRangeOptions = [
  { label: '全部区间', min: undefined, max: undefined },
  { label: '0-500', min: 0, max: 500 },
  { label: '500-1000', min: 500, max: 1000 },
  { label: '1000-2000', min: 1000, max: 2000 },
  { label: '2000-5000', min: 2000, max: 5000 },
]

export const fireLevelRangeOptions = [
  { label: '全部等级', min: undefined, max: undefined },
  { label: '38-50', min: 38, max: 50 },
  { label: '50-60', min: 50, max: 60 },
  { label: '60-70', min: 60, max: 70 },
  { label: '70+', min: 70, max: undefined },
]

export function rangeLabel(
  min: number | undefined,
  max: number | undefined,
  fallback: string
) {
  if (min !== undefined && max !== undefined) return `${min}-${max}`
  if (min !== undefined) return `${min}+`
  if (max !== undefined) return `≤${max}`
  return fallback
}

export function isRangeSelected(
  currentMin: number | undefined,
  currentMax: number | undefined,
  min: number | undefined,
  max: number | undefined
) {
  return currentMin === min && currentMax === max
}
