import { validateString } from "./validateString.mjs";

//#region src/utils/validation/validatePhone.ts
/**
* Validates a email field.
* @param value The value to validate.
* @param entityName The name of the entity being validated.
* @param minLength The minimum length of the string.
* @param maxLength The maximum length of the string.
* @returns An array of validation errors.
*/
const validatePhone = (value, entityName = "Phone", minLength = 6, maxLength = 20) => {
	const errors = validateString(value, entityName, minLength, maxLength);
	if (typeof value === "string" && !/^\+?\(?\d{3}\)?[-\s.]?\d{3}[-\s.]?\d{4,6}$/.test(value)) errors.push(`${entityName} must be a valid phone number.`);
	return errors;
};

//#endregion
export { validatePhone };
//# sourceMappingURL=validatePhone.mjs.map