// src/engine/utils/NameUtils.ts

export class NameUtils {
  static toHandlerCase(s: string): string {
    if (!s) return '';

    const spaced = String(s)
      .replace(/([a-z0-9])([A-Z])/g, '$1 $2')
      .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')
      .replace(/([A-Za-z])(\d)/g, '$1 $2')
      .replace(/(\d)([A-Za-z])/g, '$1 $2');

    const parts = spaced.split(/[.\-_\s/]+/g).filter(Boolean);
    return parts
      .map(p => p.charAt(0).toUpperCase() + p.slice(1).toLowerCase())
      .join('');
  }
}

export const toHandlerCase = NameUtils.toHandlerCase;
