"use strict";

exports.__esModule = true;
exports.default = void 0;
var _map2 = _interopRequireDefault(require("lodash/fp/map"));
var _react = _interopRequireDefault(require("react"));
var _propTypes = _interopRequireDefault(require("prop-types"));
var _inputCheckbox = _interopRequireDefault(require("../../atom/input-checkbox"));
var _button = _interopRequireDefault(require("../../atom/button"));
var _provider = _interopRequireDefault(require("../../atom/provider"));
var _style = _interopRequireDefault(require("./style.css"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const InputSplitScreen = (props, context) => {
  const {
    translate
  } = context;
  const {
    leftSection,
    rightSection,
    buttons
  } = props;
  const criteriaList = _map2.default.convert({
    cap: false
  })((criterion, key) => {
    return /*#__PURE__*/_react.default.createElement("div", {
      className: _style.default.field,
      key: key
    }, /*#__PURE__*/_react.default.createElement(_inputCheckbox.default, criterion));
  }, leftSection.values);
  const collectionList = _map2.default.convert({
    cap: false
  })((collection, key) => {
    return /*#__PURE__*/_react.default.createElement("div", {
      className: _style.default.field,
      key: key
    }, /*#__PURE__*/_react.default.createElement(_inputCheckbox.default, collection));
  }, rightSection.values);
  const buttonList = _map2.default.convert({
    cap: false
  })((button, key) => {
    return /*#__PURE__*/_react.default.createElement("div", {
      className: _style.default.button,
      key: key
    }, /*#__PURE__*/_react.default.createElement(_button.default, button));
  }, buttons);
  return /*#__PURE__*/_react.default.createElement("div", null, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.splitDefault
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.splitLeft
  }, /*#__PURE__*/_react.default.createElement("p", {
    className: _style.default.title
  }, `${leftSection.title}${leftSection.required ? '*' : ''}`), criteriaList), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.splitRight
  }, /*#__PURE__*/_react.default.createElement("p", {
    className: _style.default.title
  }, `${rightSection.title}${rightSection.required ? '*' : ''}`), collectionList)), /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.rowBottom
  }, /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.buttonGroup
  }, buttonList), /*#__PURE__*/_react.default.createElement("p", {
    className: _style.default.mandatoryFields
  }, translate('mandatory_fields'))));
};
const sectionPropTypes = process.env.NODE_ENV !== "production" ? {
  title: _propTypes.default.string.isRequired,
  values: _propTypes.default.arrayOf(_propTypes.default.shape({
    ..._inputCheckbox.default.propTypes
  })).isRequired,
  required: _propTypes.default.bool
} : {};
InputSplitScreen.propTypes = process.env.NODE_ENV !== "production" ? {
  leftSection: _propTypes.default.shape({
    ...sectionPropTypes
  }),
  rightSection: _propTypes.default.shape({
    ...sectionPropTypes
  })
} : {};
InputSplitScreen.contextTypes = {
  translate: _provider.default.childContextTypes.translate
};
const SetupCohortItem = props => {
  const {
    field
  } = props;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: _style.default.wrapper
  }, /*#__PURE__*/_react.default.createElement(InputSplitScreen, field));
};
SetupCohortItem.defaultProps = {
  field: {}
};
SetupCohortItem.propTypes = process.env.NODE_ENV !== "production" ? {
  field: _propTypes.default.shape({
    ...InputSplitScreen.propTypes
  })
} : {};
var _default = exports.default = SetupCohortItem;
//# sourceMappingURL=index.js.map