'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _propTypes = require('prop-types');

var _propTypes2 = _interopRequireDefault(_propTypes);

var _reactIntl = require('react-intl');

var _WorkflowStateIcon = require('../../../styles/cspace-ui/WorkflowStateIcon.css');

var _WorkflowStateIcon2 = _interopRequireDefault(_WorkflowStateIcon);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var messages = (0, _reactIntl.defineMessages)({
  locked: {
    'id': 'workflowStateIcon.locked',
    'defaultMessage': 'Locked'
  }
});

var propTypes = {
  intl: _reactIntl.intlShape,
  state: _propTypes2.default.string
};

function WorkflowStateIcon(props) {
  var intl = props.intl,
      state = props.state;


  if (!state || state === 'project' || state === 'replicated') {
    return null;
  }

  var message = messages[state];
  var title = message ? intl.formatMessage(message) : undefined;

  return _react2.default.createElement('div', { className: _WorkflowStateIcon2.default[state], title: title });
}

WorkflowStateIcon.propTypes = propTypes;

exports.default = (0, _reactIntl.injectIntl)(WorkflowStateIcon);