"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MailRequestById = void 0;
const validation_error_1 = require("../../errors/validation-error");
const mail_request_1 = require("./mail-request");
const mail_validator_1 = require("./validators/mail-validator");
const request_by_id_validator_1 = require("./validators/request-by-id-validator");
/**
 * A request for sending e-mails to specified users by id.
 */
class MailRequestById extends mail_request_1.MailRequest {
    constructor() {
        super(...arguments);
        this.recipients = [];
    }
    validate() {
        const mailFailures = new mail_validator_1.MailValidator().validate(this);
        const idFailures = new request_by_id_validator_1.RequestByIdValidator().validate(this);
        if (mailFailures.length === 0 && idFailures.length === 0) {
            return;
        }
        else {
            const failures = mailFailures.concat(idFailures);
            throw new validation_error_1.ValidationError("MailRequestById is invalid.", ...failures);
        }
    }
}
exports.MailRequestById = MailRequestById;
//# sourceMappingURL=mail-request-by-id.js.map