"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;

var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));

var _definitions = _interopRequireDefault(require("@polkadot/types/interfaces/democracy/definitions"));

var _types = require("@polkadot/types");

function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }

function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }

// We can ignore the properties, added via Struct.with
const _ReferendumInfo = _types.Struct.with(_definitions.default.types.ReferendumInfo);
/**
 * @name ReferendumInfoExtended
 * @description
 * A [[ReferendumInfo]] with an additional `index` field
 */


class ReferendumInfoExtended extends _ReferendumInfo {
  constructor(value, index) {
    super(value);
    this._index = void 0;
    this._index = value instanceof ReferendumInfoExtended ? value.index : (0, _types.createType)('ReferendumIndex', index);
  }
  /**
   * @description Convenience getter, returns the referendumIndex
   */


  get index() {
    return this._index;
  }
  /**
   * @description Creates the JSON representation
   */


  toJSON() {
    return _objectSpread({}, super.toJSON(), {
      index: this.index.toJSON()
    });
  }

}

exports.default = ReferendumInfoExtended;