"use strict";

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

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

var _Option = _interopRequireDefault(require("../../codec/Option"));

var _Struct = _interopRequireDefault(require("../../codec/Struct"));

var _Vec = _interopRequireDefault(require("../../codec/Vec"));

var _Storage = require("./Storage");

// Copyright 2017-2019 @polkadot/types authors & contributors
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
// Note the following errors are non-duplicated and fill the first 2 slots for
// each of the modules - this means that other errors start at index 2
//
// {
//   "name": "Other",
//   "documentation": [
//     "Other unspecified error"
//   ]
// },
// {
//   "name": "CannotLookup",
//   "documentation": [
//     "Can not lookup"
//   ]
// }

/**
 * @name ModuleMetadataV8
 * @description
 * The definition of a module in the system
 */
class ModuleMetadataV8 extends _Struct.default {
  constructor(value) {
    super({
      name: 'Text',
      storage: _Option.default.with(_Storage.StorageMetadata),
      calls: _Option.default.with('Vec<FunctionMetadataV8>'),
      events: _Option.default.with('Vec<EventMetadataV8>'),
      constants: 'Vec<ModuleConstantMetadataV8>',
      errors: 'Vec<ErrorMetadataV8>'
    }, value);
  }
  /**
   * @description the module calls
   */


  get calls() {
    return this.get('calls');
  }
  /**
   * @description the module constants
   */


  get constants() {
    return this.get('constants');
  }
  /**
   * @description the module errors
   */


  get errors() {
    return this.get('errors');
  }
  /**
   * @description the module events
   */


  get events() {
    return this.get('events');
  }
  /**
   * @description the module name
   */


  get name() {
    return this.get('name');
  }
  /**
   * @description the associated module storage
   */


  get storage() {
    return this.get('storage');
  }

}
/**
 * @name MetadataV8
 * @description
 * The runtime metadata as a decoded structure
 */


exports.ModuleMetadataV8 = ModuleMetadataV8;

class MetadataV8 extends _Struct.default {
  constructor(value) {
    super({
      modules: _Vec.default.with(ModuleMetadataV8)
    }, value);
  }
  /**
   * @description The associated modules for this structure
   */


  get modules() {
    return this.get('modules');
  }

}

exports.default = MetadataV8;