/**
 * Normalizes a phone number for duplicate checks and storage
 */
export function normalizePhoneNumber(phone: string): string {
  if (!phone) return '';
  // Remove non-digit characters
  const digits = phone.replace(/\D/g, '');
  // If Indian mobile with country code (e.g. 919876543210), strip the country code if it is 12 digits
  if (digits.length === 12 && digits.startsWith('91')) {
    return digits.substring(2);
  }
  return digits;
}
