"use strict";

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

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

function _object() {
  const data = _interopRequireDefault(require("../objects/object"));

  _object = function () {
    return data;
  };

  return data;
}

function _utils() {
  const data = require("../../utils");

  _utils = function () {
    return data;
  };

  return data;
}

class ScopeMeta extends _object().default {
  constructor(props) {
    super();
    this.license = props.license;
    this.name = props.name;
  }

  toObject() {
    return {
      license: this.license,
      name: this.name
    };
  }

  toString(pretty) {
    const args = (0, _utils().getStringifyArgs)(pretty);
    return JSON.stringify(this.toObject(), ...args);
  }

  id() {
    return this.name;
  }

  toBuffer(pretty) {
    return Buffer.from(this.toString(pretty));
  }

  static fromScopeName(name) {
    return ScopeMeta.fromObject({
      name
    }).hash();
  }

  static parse(propsStr) {
    return this.fromObject(JSON.parse(propsStr));
  }

  static fromObject(props) {
    return new ScopeMeta(props);
  }

  static from(props) {
    return ScopeMeta.fromObject(props);
  }

}

exports.default = ScopeMeta;