"use strict";
// Copyright 2017-2020 @polkadot/api-derive authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const definitions_1 = __importDefault(require("../../types/interfaces/democracy/definitions"));
const types_1 = require("../../types");
// We can ignore the properties, added via Struct.with
const _ReferendumInfo = types_1.Struct.with(definitions_1.default.types.ReferendumInfo);
/**
 * @name ReferendumInfoExtended
 * @description
 * A [[ReferendumInfo]] with an additional `index` field
 */
class ReferendumInfoExtended extends _ReferendumInfo {
    constructor(registry, value, index) {
        super(registry, value);
        this._index = value instanceof ReferendumInfoExtended
            ? value.index
            : types_1.createType(registry, 'ReferendumIndex', index);
    }
    /**
     * @description Convenience getter, returns the referendumIndex
     */
    get index() {
        return this._index;
    }
    /**
     * @description Creates the JSON representation
     */
    toJSON() {
        return Object.assign(Object.assign({}, super.toJSON()), { index: this.index.toJSON() });
    }
}
exports.default = ReferendumInfoExtended;
