"use strict";
/* tslint:disable class-name */
Object.defineProperty(exports, "__esModule", { value: true });
const AuthorsRule_1 = require("../../../../rules/AuthorsRule");
const ValidationException_1 = require("../../../../validation/ValidationException");
function wise_rule_authors_encode(r) {
    let mode;
    if (r.mode === AuthorsRule_1.AuthorsRule.Mode.ALLOW)
        mode = "allow";
    else if (r.mode === AuthorsRule_1.AuthorsRule.Mode.DENY)
        mode = "deny";
    else
        throw new ValidationException_1.ValidationException("AuthorsRule, unknown mode: " + r.mode);
    const out = {
        rule: "authors",
        mode: mode,
        authors: r.authors
    };
    return out;
}
exports.wise_rule_authors_encode = wise_rule_authors_encode;
function wise_rule_authors_decode(r) {
    let mode;
    if (r.mode === "allow")
        mode = AuthorsRule_1.AuthorsRule.Mode.ALLOW;
    else if (r.mode === "deny")
        mode = AuthorsRule_1.AuthorsRule.Mode.DENY;
    else
        throw new ValidationException_1.ValidationException("v2:wise_rule_authors: unknown mode " + r.mode);
    return new AuthorsRule_1.AuthorsRule(mode, r.authors);
}
exports.wise_rule_authors_decode = wise_rule_authors_decode;
//# sourceMappingURL=rule-authors-schema.js.map