"use strict";
/* tslint:disable class-name */
Object.defineProperty(exports, "__esModule", { value: true });
const ValidationException_1 = require("../../../../validation/ValidationException");
const VotingPowerRule_1 = require("../../../../rules/VotingPowerRule");
function wise_rule_voting_power_encode(r) {
    let mode;
    if (r.mode === VotingPowerRule_1.VotingPowerRule.Mode.MORE_THAN)
        mode = "more_than";
    else if (r.mode === VotingPowerRule_1.VotingPowerRule.Mode.LESS_THAN)
        mode = "less_than";
    else if (r.mode === VotingPowerRule_1.VotingPowerRule.Mode.EQUAL)
        mode = "equal";
    else
        throw new ValidationException_1.ValidationException("VotingPowerRule: unknown mode " + r.mode);
    const out = {
        rule: "voting_power",
        mode: mode,
        value: r.value
    };
    return out;
}
exports.wise_rule_voting_power_encode = wise_rule_voting_power_encode;
function wise_rule_voting_power_decode(r) {
    let mode;
    if (r.mode === "more_than")
        mode = VotingPowerRule_1.VotingPowerRule.Mode.MORE_THAN;
    else if (r.mode === "less_than")
        mode = VotingPowerRule_1.VotingPowerRule.Mode.LESS_THAN;
    else if (r.mode === "equal")
        mode = VotingPowerRule_1.VotingPowerRule.Mode.EQUAL;
    else
        throw new ValidationException_1.ValidationException("v2:wise_rule_voting_power: unknown mode " + r.mode);
    return new VotingPowerRule_1.VotingPowerRule(mode, r.value);
}
exports.wise_rule_voting_power_decode = wise_rule_voting_power_decode;
//# sourceMappingURL=rule-voting-power-schema.js.map