function phoneBeautify(phone: string): string {
  const cleaned = phone.replace(/[^\d+]/g, '');

  const match = cleaned.match(/^\+?7(\d{3})(\d{3})(\d{2})(\d{2})$/);
  if (!match) return phone;

  const [, code, part1, part2, part3] = match;

  return `+7 (${code}) ${part1}-${part2}-${part3}`;
}

export { phoneBeautify };
