export var VENUE_WALL_STATUS_COLOR_MAP = {
  inUse: {
    key: 'inUse',
    label: 'In Use',
    note: 'This court is currently in use.',
    color: '#6f4ae6',
    noteBg: 'rgba(111,74,230,0.92)'
  },
  endingSoon: {
    key: 'endingSoon',
    label: 'Ending Soon',
    note: 'Please leave on time to avoid overtime charges.',
    color: '#f59e0b',
    noteBg: 'rgba(245,158,11,0.96)'
  },
  expired: {
    key: 'expired',
    label: 'Expired',
    note: 'This booking has ended. Please clear the court.',
    color: '#ef4444',
    noteBg: 'rgba(239,68,68,0.96)'
  },
  available: {
    key: 'available',
    label: 'Available',
    note: 'This court is now available.',
    color: '#10b981',
    noteBg: 'rgba(16,185,129,0.18)'
  },
  boardingSoon: {
    key: 'boardingSoon',
    label: 'Boarding Soon',
    note: 'Please check in to start.',
    color: '#6f4ae6',
    noteBg: 'rgba(111,74,230,0.18)'
  },
  late: {
    key: 'late',
    label: 'Late',
    note: 'Please check in as soon as possible.',
    /** 与 available 同色板一致；主倒计时红色在 VenueWallCard 内单独覆盖 */
    color: '#10b981',
    noteBg: 'rgba(16,185,129,0.18)'
  }
};
export function alphaColor(hex, alpha) {
  var clean = hex.replace('#', '');
  var full = clean.length === 3 ? clean.split('').map(function (c) {
    return c + c;
  }).join('') : clean;
  var num = parseInt(full, 16);
  var r = num >> 16 & 255;
  var g = num >> 8 & 255;
  var b = num & 255;
  return "rgba(".concat(r, ", ").concat(g, ", ").concat(b, ", ").concat(alpha, ")");
}
export var clamp = function clamp(value, min, max) {
  return Math.max(min, Math.min(max, value));
};

/** 由卡片字段推导状态键（与演示页 test.tsx 规则一致） */
export function deriveVenueWallStatus(card) {
  var s = card.status;
  if (s === 'available') return 'available';
  if (s === 'boardingSoon') return 'boardingSoon';
  if (s === 'late') return 'late';
  if (s === 'endingSoon') return 'endingSoon';
  if (s === 'expired') return 'expired';
  if (s === 'inUse') return 'inUse';

  /** 兼容旧数据：无 status 时退回 remainingMin 推断（不再看 light 字段） */
  if (card.currentBooking === 'Available to Book') return 'available';
  var rm = card.remainingMin;
  if (rm != null && rm <= 0) return 'expired';
  if (rm != null && rm <= 10) return 'endingSoon';
  return 'inUse';
}
export function formatVenueWallCountdown(min) {
  if (min < 0) return "".concat(Math.abs(min), "m overtime");
  if (min === 0) return 'Ending now';
  return "".concat(min, "m left");
}