"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
const _ = require("lodash");
const Rule_1 = require("./Rule");
const ValidationException_1 = require("../validation/ValidationException");
class CustomRPCRule extends Rule_1.Rule {
    constructor(host, port, path, method) {
        super();
        this.rule = Rule_1.Rule.Type.CustomRPC;
        this.host = host;
        this.port = port;
        this.path = path;
        this.method = method;
    }
    type() {
        return Rule_1.Rule.Type.CustomRPC;
    }
    validate(voteorder, context) {
        return __awaiter(this, void 0, void 0, function* () {
            throw new ValidationException_1.ValidationException("CustomRPC rule is not yet implemented"); // TODO
        });
    }
    validateRuleObject(unprototypedObj) {
        ["host", "port", "path", "method"].forEach(prop => {
            if (!_.has(unprototypedObj, prop))
                throw new ValidationException_1.ValidationException("CustomRPCRule: property " + prop + " is missing");
        });
    }
    getDescription() {
        return "CustomRPC to " + this.host + ":" + this.port + "/" + this.path + " " + this.method + "()";
    }
}
exports.CustomRPCRule = CustomRPCRule;
//# sourceMappingURL=CustomRPCRule.js.map