'use strict';

const filterItemType_enum = require('./filter-item-type.enum-a7ffdaa6.js');

function hasActiveElements(value) {
  var _a;
  const list = Array.isArray(value) ? value : value === null || value === void 0 ? void 0 : value.elements;
  return ((_a = list === null || list === void 0 ? void 0 : list.filter((val) => val === null || val === void 0 ? void 0 : val.check)) === null || _a === void 0 ? void 0 : _a.length) > 0;
}
function getInvalidFilters(filters) {
  if (!filters || filters.length === 0) {
    return [];
  }
  return filters.filter(item => {
    if (!item.required) {
      return false;
    }
    if (item.type === filterItemType_enum.FilterItemType.MULTI_LIST) {
      return !hasActiveElements(item.value);
    }
    return !item.value;
  });
}
function validateFilters(filters) {
  var _a;
  const notValidFilters = (_a = getInvalidFilters(filters)) !== null && _a !== void 0 ? _a : [];
  return notValidFilters.length === 0;
}

exports.getInvalidFilters = getInvalidFilters;
exports.validateFilters = validateFilters;
