import { ValidationError } from "../../errors/validation-error";
import { MailRequest } from "./mail-request";
import { MailValidator } from "./validators/mail-validator";
import { RequestByIdValidator } from "./validators/request-by-id-validator";
/**
 * A request for sending e-mails to specified users by id.
 */
export class MailRequestById extends MailRequest {
    constructor() {
        super(...arguments);
        this.recipients = [];
    }
    validate() {
        const mailFailures = new MailValidator().validate(this);
        const idFailures = new RequestByIdValidator().validate(this);
        if (mailFailures.length === 0 && idFailures.length === 0) {
            return;
        }
        else {
            const failures = mailFailures.concat(idFailures);
            throw new ValidationError("MailRequestById is invalid.", ...failures);
        }
    }
}
//# sourceMappingURL=mail-request-by-id.js.map