import warning from 'warning';
import { setWindow } from '@skbkontur/global-object';
var specificityLevel = 0;
var canModifySpecificityLevel = true;
var specificityClassName = 'react-ui';
var canModifySpecificityClassName = true;

//TODO Delete Upgrade in major release if it still doesn't work (https://github.com/skbkontur/retail-ui/blob/next/packages/react-ui/MIGRATION.md)
export var Upgrade = {
  getSpecificityLevel: function getSpecificityLevel() {
    canModifySpecificityLevel = false;
    return specificityLevel;
  },
  setSpecificityLevel: function setSpecificityLevel(level) {
    warning(false, "setSpecificityLevel doesn't work. For more information please visit https://github.com/skbkontur/retail-ui/blob/master/packages/react-ui/MIGRATION.md");
    if (canModifySpecificityLevel) {
      specificityLevel = level;
    } else {
      warning(false, "specificityLevel=" + specificityLevel + " \u0443\u0436\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D");
    }
  },
  getSpecificityClassName: function getSpecificityClassName() {
    canModifySpecificityClassName = false;
    return specificityClassName;
  },
  setSpecificityClassName: function setSpecificityClassName(className) {
    if (canModifySpecificityClassName) {
      specificityClassName = className;
    } else {
      warning(false, "specificityClassName=" + specificityClassName + " \u0443\u0436\u0435 \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D");
    }
  },
  setWindow: setWindow
};