"use strict";

function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }

require("core-js/modules/es.reflect.construct.js");

require("core-js/modules/es.object.create.js");

require("core-js/modules/es.object.define-property.js");

require("core-js/modules/es.symbol.js");

require("core-js/modules/es.symbol.description.js");

require("core-js/modules/es.object.to-string.js");

require("core-js/modules/es.symbol.iterator.js");

require("core-js/modules/es.array.iterator.js");

require("core-js/modules/es.string.iterator.js");

require("core-js/modules/web.dom-collections.iterator.js");

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

require("core-js/modules/es.object.set-prototype-of.js");

require("core-js/modules/es.object.get-prototype-of.js");

var _common = require("../common");

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }

function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }

function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }

function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }

function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }

function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }

function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }

function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }

/**
 * A fixture class for testing the Resource ABC.
 */
var ResourceFixture = /*#__PURE__*/function (_Resource) {
  _inherits(ResourceFixture, _Resource);

  var _super = _createSuper(ResourceFixture);

  function ResourceFixture() {
    _classCallCheck(this, ResourceFixture);

    return _super.apply(this, arguments);
  }

  _createClass(ResourceFixture, [{
    key: "serializeAPI",
    value:
    /**
     * A trivial serializeAPI operation for testing the `save` function.
     */
    function serializeAPI() {
      return {
        id: this.id
      };
    }
    /**
     * A trivial deserializeAPI function for testing the `save` function.
     * @param data Data to deserialize. must have an id.
     */

  }, {
    key: "deserializeAPI",
    value: function deserializeAPI(data) {
      this.id = data === null || data === void 0 ? void 0 : data.id;
    }
    /**
     * A trivial apiFactory funciton for testing the `list` and `get` function.
     *
     * @param data The data from the server
     *
     * @returns A new resource created from the given data.
     */

  }, {
    key: "serializeRedux",
    value:
    /**
     * A trivial deserializeAPI function.
     */
    function serializeRedux() {
      return {
        id: this.id
      };
    }
  }], [{
    key: "apiFactory",
    value: function apiFactory(data) {
      var resource = new ResourceFixture();
      resource.deserializeAPI(data);
      return resource;
    }
    /**
     * The name of the service the resource belongs to.
     */

  }, {
    key: "serviceName",
    get: function get() {
      return "test-service";
    }
    /**
     * Name of the resource
     */

  }, {
    key: "resourceName",
    get: function get() {
      return "test-resource";
    }
  }]);

  return ResourceFixture;
}(_common.Resource);

exports.ResourceFixture = ResourceFixture;
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy90ZXN0cy9maXh0dXJlcy50cyJdLCJuYW1lcyI6WyJSZXNvdXJjZUZpeHR1cmUiLCJpZCIsImRhdGEiLCJyZXNvdXJjZSIsImRlc2VyaWFsaXplQVBJIiwiUmVzb3VyY2UiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBRUE7QUFDQTtBQUNBO0lBQ2FBLGU7Ozs7Ozs7Ozs7Ozs7O0FBQ1g7QUFDRjtBQUNBO0FBQ0UsNEJBQStDO0FBQzdDLGFBQU87QUFBRUMsUUFBQUEsRUFBRSxFQUFFLEtBQUtBO0FBQVgsT0FBUDtBQUNEO0FBRUQ7QUFDRjtBQUNBO0FBQ0E7Ozs7V0FDRSx3QkFBc0JDLElBQXRCLEVBQTJEO0FBQ3pELFdBQUtELEVBQUwsR0FBVUMsSUFBVixhQUFVQSxJQUFWLHVCQUFVQSxJQUFJLENBQUVELEVBQWhCO0FBQ0Q7QUFFRDtBQUNGO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTs7Ozs7QUFxQkU7QUFDRjtBQUNBO0FBQ0UsOEJBQWlEO0FBQy9DLGFBQU87QUFBRUEsUUFBQUEsRUFBRSxFQUFFLEtBQUtBO0FBQVgsT0FBUDtBQUNEOzs7V0F6QkQsb0JBQXlCQyxJQUF6QixFQUFrRTtBQUNoRSxVQUFNQyxRQUFRLEdBQUcsSUFBSUgsZUFBSixF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