"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.validateIds = exports.validateId = void 0;
const WizError_1 = require("../modules/WizError");
function validateId(id) {
    if (isIncorrectId(id)) {
        throw new WizError_1.WizError('NOT_VALID_ID', id);
    }
    return Promise.resolve();
}
exports.validateId = validateId;
function validateIds(ids) {
    const incorrecIds = ids.filter(isIncorrectId);
    if (incorrecIds.length) {
        throw new WizError_1.WizError('NOT_VALID_ID', incorrecIds.join(', '));
    }
    return Promise.resolve();
}
exports.validateIds = validateIds;
function isIncorrectId(id) {
    const idRegexp = /^[A-Za-z_]+[A-Za-z_0-9]+$/;
    return !idRegexp.test(id);
}
//# sourceMappingURL=validateId.js.map