import 'package:easy_localization/easy_localization.dart';

class SkillExpValidator {
  SkillExpValidator._();

  static String? validate(String value) {
    if (value.isEmpty) {
      return 'experience_is_required'.tr();
    }
    var parsed = int.tryParse(value);
    if (value.isNotEmpty && parsed == null) {
      return 'experience_must_be_a_number'.tr();
    }

    if (value.isNotEmpty && parsed! > 20 || parsed! < 1) {
      return 'experience_must_be_between_1_and_20'.tr();
    }

    return null;
  }
}
