"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const light_1 = require("protobufjs/light");
const protobuf_1 = require("../protobuf");
class ChainConfig extends light_1.Message {
    constructor(properties) {
        super(properties);
        /* Protobuf aliases */
        Object.defineProperty(this, "blockinterval", {
            get() {
                return this.blockInterval;
            },
            set(value) {
                this.blockInterval = value;
            },
        });
        Object.defineProperty(this, "maxblocksize", {
            get() {
                return this.maxBlockSize;
            },
            set(value) {
                this.maxBlockSize = value;
            },
        });
    }
    /**
     * @see README#Message classes
     */
    static register() {
        protobuf_1.registerMessage("byzcoin.ChainConfig", ChainConfig);
    }
    /**
     * Create a chain configuration from a known instance
     * @param proof The proof for the instance
     */
    static fromProof(proof) {
        return ChainConfig.decode(proof.stateChangeBody.value);
    }
    /**
     * Return a string representation of a config
     */
    toString() {
        let res = "Chainconfig:\n";
        res += "- roster:\n";
        res += this.roster.toTOML() + "\n";
        res += "- blockInterval: " + this.blockInterval + "\n";
        res += "- maxBlockSize: " + this.maxBlockSize + "\n";
        return res;
    }
}
exports.default = ChainConfig;
ChainConfig.register();
