"use strict";

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

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

var _Enum = _interopRequireDefault(require("../codec/Enum"));

// 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.
class StorageHasher extends _Enum.default {
  constructor(value) {
    super(['Blake2_128', 'Blake2_256', 'Twox128', 'Twox256', 'Twox64Concat'], value);
  }
  /**
   * @description Is the enum Blake2_128?
   */


  get isBlake2128() {
    return this.toNumber() === 0;
  }
  /**
   * @description Is the enum Blake2_256?
   */


  get isBlake2256() {
    return this.toNumber() === 1;
  }
  /**
   * @description Is the enum Twox128?
   */


  get isTwox128() {
    return this.toNumber() === 2;
  }
  /**
   * @description Is the enum Twox256?
   */


  get isTwox256() {
    return this.toNumber() === 3;
  }
  /**
   * @description Is the enum isTwox64Concat?
   */


  get isTwox64Concat() {
    return this.toNumber() === 4;
  }

  toJSON() {
    // This looks prettier in the generated JSON
    return this.toString();
  }

}

exports.default = StorageHasher;