'use strict';

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

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var PropTypes__default = /*#__PURE__*/_interopDefault(PropTypes);

var RuleBuilderColumnsPropType = PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
  id: PropTypes__default.default.string.isRequired,
  name: PropTypes__default.default.string.isRequired,
  /**
   * An array of operands that will be passed to the second dropdown and used for determining
   * the filtering logic. Operands require an id and a name. the onChange events will pass the
   * operand id into the operand propery of the rule object.
   */
  operands: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
    id: PropTypes__default.default.string.isRequired,
    name: PropTypes__default.default.string.isRequired
  })),
  /**
   * The renderField function will be passed one object parameter.
   * The onChange property expects only the new value of the rule to be passed--not events or other
   * details. Just the value  that will be assigned to the rule object's value property.
   *
   * @param {object} props The value property of the rule and the onChange handler to pass
   *                       changes back to the rule tree.
   */
  renderField: PropTypes__default.default.func
}));
var GroupLogicPropType = PropTypes__default.default.oneOf(['ALL', 'ANY']);
var RulesPropType = PropTypes__default.default.shape({
  id: PropTypes__default.default.string.isRequired,
  columnId: PropTypes__default.default.string.isRequired,
  value: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.bool, PropTypes__default.default.number, PropTypes__default.default.arrayOf(PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.object, PropTypes__default.default.number]))]).isRequired,
  operand: PropTypes__default.default.string.isRequired
});
var RuleGroupPropType = PropTypes__default.default.shape({
  id: PropTypes__default.default.string.isRequired,
  groupLogic: GroupLogicPropType.isRequired
});
RuleGroupPropType.rules = PropTypes__default.default.arrayOf(PropTypes__default.default.oneOf([RulesPropType, RuleGroupPropType]));
var RuleBuilderFilterPropType = PropTypes__default.default.shape({
  /** Unique id for particular filter */
  filterId: PropTypes__default.default.string,
  /** Text for main tilte of page */
  filterTitleText: PropTypes__default.default.string,
  /** Text for metadata for the filter */
  filterMetaText: PropTypes__default.default.string,
  /** tags associated with particular filter */
  filterTags: PropTypes__default.default.arrayOf(PropTypes__default.default.string),
  /** users that have access to particular filter */
  filterAccess: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
    userName: PropTypes__default.default.string,
    email: PropTypes__default.default.string,
    name: PropTypes__default.default.string,
    /** access types */
    access: PropTypes__default.default.oneOf(['edit', 'read'])
  })),
  /** All possible users that can be granted access */
  filterUsers: PropTypes__default.default.arrayOf(PropTypes__default.default.shape({
    userName: PropTypes__default.default.string,
    email: PropTypes__default.default.string,
    name: PropTypes__default.default.string
  })),
  /**
   * the rules passed into the component. The RuleBuilder is a controlled component, so
   * this works the same as passing defaultValue to a controlled input component.
   */
  filterRules: RuleGroupPropType,
  filterColumns: RuleBuilderColumnsPropType.isRequired
});

exports.GroupLogicPropType = GroupLogicPropType;
exports.RuleBuilderColumnsPropType = RuleBuilderColumnsPropType;
exports.RuleBuilderFilterPropType = RuleBuilderFilterPropType;
exports.RuleGroupPropType = RuleGroupPropType;
exports.RulesPropType = RulesPropType;
