abstract class SocialNumberValidator {
  static String? validate(String? socialNumber, {bool isRequired = true}) {
    // Regular expression for validating US social number
    final ssnRegex =
        RegExp(r'^(?!000|666|9\d{2})\d{3}-(?!00)\d{2}-(?!0000)\d{4}$');

    if (isRequired && (socialNumber == null || socialNumber.isEmpty)) {
      return 'Social number is required';
    } else if (socialNumber != null && !ssnRegex.hasMatch(socialNumber)) {
      return 'Invalid social number';
    }
    return null;
  }
}
