"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports.SchemaCardState = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _lodash = require("lodash");
var _SchemaFieldsState = require("./SchemaFieldsState");
class SchemaCardState {
  constructor(params) {
    (0, _defineProperty2.default)(this, "fieldsState", void 0);
    if ((0, _lodash.isEmpty)(params.fields)) {
      console.warn('SchemaCardState: `fields` is empty — field persistency will not be enabled.');
    }
    const {
      componentId,
      artifactId
    } = params.container.environment;
    const namespace = [componentId || artifactId, params.persistencyKey].join('.');
    const dataCapsule = params.container._createComponentSettings({
      namespace
    });
    this.fieldsState = new _SchemaFieldsState.SchemaFieldsState({
      dataCapsule,
      fields: params.fields
    });
  }
  init() {
    this.fieldsState.init();
  }
}
exports.SchemaCardState = SchemaCardState;
//# sourceMappingURL=SchemaCardState.js.map