"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.makePhonePatternRule = exports.makeRequiredRule = exports.makePhoneValidationMessage = exports.makeRequiredValidationMessage = exports.makeEmailPatternRule = exports.makeEmailPatternValidationMessage = exports.isPasswordMatch = exports.makePasswordPatternRule = exports.makePasswordMatchValidationMessage = exports.makePasswordPatternValidationMessage = exports.PHONE_REGEX = exports.PASSWORD_REGEX = exports.EMAIL_REGEX = void 0;
const Translation_1 = require("../translations/Translation");
exports.EMAIL_REGEX = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
exports.PASSWORD_REGEX = /^(?=.*[A-Z])(?=.*[a-z])(?=.*\d)(?=.*[><?@+'`~^%&*[\]{}.!#|\\"$';,:;=\\/(),-\s+])[A-Za-z\u0600-\u06FF\u0430-\u044f\u0590-\u05FF\u0370-\u03ff\u1f00-\u1fff\d><?@+'`~^%&*[\]{}.!#|\\"$';,:;=\\/(),-\s+]{8,}$/;
exports.PHONE_REGEX = /.*\s\d+/;
const makePasswordPatternValidationMessage = (t) => t(Translation_1.Translation.UserPortal.ProfileScreen.Validation.Password.IsNotValid);
exports.makePasswordPatternValidationMessage = makePasswordPatternValidationMessage;
const makePasswordMatchValidationMessage = (t) => t(Translation_1.Translation.UserPortal.ProfileScreen.Validation.Password.DoesNotMatch);
exports.makePasswordMatchValidationMessage = makePasswordMatchValidationMessage;
const makePasswordPatternRule = (t) => ({
    value: exports.PASSWORD_REGEX,
    message: (0, exports.makePasswordPatternValidationMessage)(t),
});
exports.makePasswordPatternRule = makePasswordPatternRule;
const isPasswordMatch = (t) => (passwordValue) => (repeatPassword) => {
    return !repeatPassword || repeatPassword === passwordValue || (0, exports.makePasswordMatchValidationMessage)(t);
};
exports.isPasswordMatch = isPasswordMatch;
const makeEmailPatternValidationMessage = (t) => t(Translation_1.Translation.UserPortal.ProfileScreen.Validation.Email.IsNotValid);
exports.makeEmailPatternValidationMessage = makeEmailPatternValidationMessage;
const makeEmailPatternRule = (t) => ({
    value: exports.EMAIL_REGEX,
    message: (0, exports.makeEmailPatternValidationMessage)(t),
});
exports.makeEmailPatternRule = makeEmailPatternRule;
const makeRequiredValidationMessage = (t) => (fieldLabel) => t(Translation_1.Translation.UserPortal.ProfileScreen.Validation.Common.IsRequired, {
    fieldLabel: fieldLabel || t(Translation_1.Translation.UserPortal.ProfileScreen.Validation.Common.ThisField),
});
exports.makeRequiredValidationMessage = makeRequiredValidationMessage;
const makePhoneValidationMessage = (t) => t(Translation_1.Translation.UserPortal.ProfileScreen.Validation.Phone.IsNotValid);
exports.makePhoneValidationMessage = makePhoneValidationMessage;
const makeRequiredRule = (t) => (isRequired, fieldLabel) => ({
    value: isRequired,
    message: (0, exports.makeRequiredValidationMessage)(t)(fieldLabel),
});
exports.makeRequiredRule = makeRequiredRule;
const makePhonePatternRule = (t) => ({
    value: exports.PHONE_REGEX,
    message: (0, exports.makePhoneValidationMessage)(t),
});
exports.makePhonePatternRule = makePhonePatternRule;
//# sourceMappingURL=Validation.js.map