text: import { ErrorReasons } from "../enums";
  
  /**
   * @typedef {Object} options
   * @property {Number} [max]
   * @property {Number} [min]
   */
  
  /**
   * Generates the ErrorMessage based on the error reason
   * It personalizes it using the field label
   *
   * @param {string} label
   * @param {ErrorReasons} reason
   * @param {options} [options]
   */
  export default function MessageGenerator(label, reason, options) {
    switch (reason) {
      case ErrorReasons.alphabetic:
        return `${label} can only contain alphabetic characters`;
  
      case ErrorReasons.email:
        return `${label} must be valid`;
  
      case ErrorReasons.max:
        return `${label} must be less than or equal to ${options.max}`;
  
      case ErrorReasons.min:
        return `${label} must be greater than or equal to ${options.min}`;
  
      case ErrorReasons.numeric:
        return `${label} must be a number`;
  
      case ErrorReasons.unique:
        return `${label} must be unique`;
  
      default:
        // ErrorReasons.required
        return `${label} is required`;
    }
  }
  