"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const PayoutRule_1 = require("../../../../rules/PayoutRule");
const ValidationException_1 = require("../../../../validation/ValidationException");
function wise_rule_payout_encode(r) {
    let mode;
    if (r.mode === PayoutRule_1.PayoutRule.Mode.EQUAL)
        mode = "equal";
    else if (r.mode === PayoutRule_1.PayoutRule.Mode.MORE_THAN)
        mode = "more_than";
    else if (r.mode === PayoutRule_1.PayoutRule.Mode.LESS_THAN)
        mode = "less_than";
    else
        throw new ValidationException_1.ValidationException("PayoutRule: unknown mode " + r.mode);
    const out = {
        rule: "payout",
        mode: mode,
        value: r.value
    };
    return out;
}
exports.wise_rule_payout_encode = wise_rule_payout_encode;
function wise_rule_payout_decode(r) {
    let mode;
    if (r.mode === "equal")
        mode = PayoutRule_1.PayoutRule.Mode.EQUAL;
    else if (r.mode === "more_than")
        mode = PayoutRule_1.PayoutRule.Mode.MORE_THAN;
    else if (r.mode === "less_than")
        mode = PayoutRule_1.PayoutRule.Mode.LESS_THAN;
    else
        throw new ValidationException_1.ValidationException("v2:wise_rule_payout: unknown mode " + r.mode);
    return new PayoutRule_1.PayoutRule(mode, r.value);
}
exports.wise_rule_payout_decode = wise_rule_payout_decode;
//# sourceMappingURL=rule-payout-schema.js.map