// Helper function to format price (handles both number and string prices)
export function formatPrice(price) {
  if (typeof price === 'number') {
    return `$${price.toFixed(2)}`;
  }
  if (typeof price === 'string') {
    // If it's already formatted as a string (e.g., "$125-$250"), return as-is
    return price.startsWith('$') ? price : `$${price}`;
  }
  return '$0.00';
}

// Helper function to get numeric price for calculations (returns 0 for string prices)
export function getNumericPrice(price) {
  if (typeof price === 'number') {
    return price;
  }
  if (typeof price === 'string') {
    // Try to extract a number from string prices like "$125-$250"
    const match = price.match(/\d+/);
    if (match) {
      return parseFloat(match[0]);
    }
  }
  return 0;
}
