/*
 * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import React, { memo } from "react";
import { FilterInputExcludeRow } from "../base/FilterInputExcludeRow.js";
import { ContainsTextFilterInput } from "./ContainsTextFilterInput.js";
import { DateRangeFilterInput } from "./DateRangeFilterInput.js";
import { ListogramFilterInput } from "./ListogramFilterInput.js";
import { MultiDateFilterInput } from "./MultiDateFilterInput.js";
import { MultiSelectFilterInput } from "./MultiSelectFilterInput.js";
import { NumberRangeFilterInput } from "./NumberRangeFilterInput.js";
import { SingleDateFilterInput } from "./SingleDateFilterInput.js";
import { SingleSelectFilterInput } from "./SingleSelectFilterInput.js";
import { TextTagsFilterInput } from "./TextTagsFilterInput.js";
import { TimelineFilterInput } from "./TimelineFilterInput.js";
import { ToggleFilterInput } from "./ToggleFilterInput.js";
function PropertyFilterInputInner({
  objectType,
  objectSet,
  definition,
  filterState,
  onFilterStateChanged,
  whereClause,
  linkedFilters,
  showFilteredOutValues,
  searchQuery,
  excludeRowOpen,
  layout
}) {
  switch (definition.filterComponent) {
    case "CONTAINS_TEXT":
      return /*#__PURE__*/React.createElement(FilterInputExcludeRow, {
        excludeRowOpen: excludeRowOpen,
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged
      }, /*#__PURE__*/React.createElement(ContainsTextFilterInput, {
        propertyKey: definition.key,
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged
      }));
    case "TOGGLE":
      return /*#__PURE__*/React.createElement(ToggleFilterInput, {
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged
      });
    case "NUMBER_RANGE":
      return /*#__PURE__*/React.createElement(NumberRangeFilterInput, {
        objectType: objectType,
        objectSet: objectSet,
        propertyKey: definition.key,
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged,
        whereClause: whereClause,
        clickToFilter: definition.clickToFilter
      });
    case "DATE_RANGE":
      return /*#__PURE__*/React.createElement(DateRangeFilterInput, {
        objectType: objectType,
        objectSet: objectSet,
        propertyKey: definition.key,
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged,
        whereClause: whereClause,
        formatDate: definition.formatDate,
        clickToFilter: definition.clickToFilter
      });
    case "SINGLE_SELECT":
      return /*#__PURE__*/React.createElement(SingleSelectFilterInput, {
        objectType: objectType,
        objectSet: objectSet,
        propertyKey: definition.key,
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged,
        whereClause: whereClause,
        linkedFilters: linkedFilters,
        showFilteredOutValues: showFilteredOutValues,
        excludeRowOpen: excludeRowOpen,
        renderValue: definition.renderValue,
        showCount: definition.showCount
      });
    case "MULTI_SELECT":
      return /*#__PURE__*/React.createElement(MultiSelectFilterInput, {
        objectType: objectType,
        objectSet: objectSet,
        propertyKey: definition.key,
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged,
        whereClause: whereClause,
        linkedFilters: linkedFilters,
        showFilteredOutValues: showFilteredOutValues,
        excludeRowOpen: excludeRowOpen,
        renderValue: definition.renderValue,
        showCount: definition.showCount,
        layout: layout
      });
    case "SINGLE_DATE":
      return /*#__PURE__*/React.createElement(SingleDateFilterInput, {
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged,
        formatDate: definition.formatDate
      });
    case "MULTI_DATE":
      return /*#__PURE__*/React.createElement(MultiDateFilterInput, {
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged,
        formatDate: definition.formatDate
      });
    case "LISTOGRAM":
      return /*#__PURE__*/React.createElement(ListogramFilterInput, {
        objectType: objectType,
        objectSet: objectSet,
        propertyKey: definition.key,
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged,
        whereClause: whereClause,
        linkedFilters: linkedFilters,
        showFilteredOutValues: showFilteredOutValues,
        colorMap: definition.colorMap,
        displayMode: definition.listogramConfig?.displayMode,
        showCount: definition.showCount,
        maxVisibleItems: definition.listogramConfig?.maxVisibleItems ?? 5,
        searchQuery: searchQuery,
        excludeRowOpen: excludeRowOpen,
        renderValue: definition.renderValue
      });
    case "TEXT_TAGS":
      return /*#__PURE__*/React.createElement(TextTagsFilterInput, {
        objectType: objectType,
        objectSet: objectSet,
        propertyKey: definition.key,
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged,
        whereClause: whereClause,
        excludeRowOpen: excludeRowOpen
      });
    case "TIMELINE":
      return /*#__PURE__*/React.createElement(FilterInputExcludeRow, {
        excludeRowOpen: excludeRowOpen,
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged
      }, /*#__PURE__*/React.createElement(TimelineFilterInput, {
        filterState: filterState,
        onFilterStateChanged: onFilterStateChanged,
        formatDate: definition.formatDate
      }));
    default:
      return /*#__PURE__*/React.createElement("div", {
        "data-unsupported": "true"
      }, "Unsupported filter component: ", definition.filterComponent);
  }
}
export const PropertyFilterInput = /*#__PURE__*/memo(PropertyFilterInputInner);
//# sourceMappingURL=PropertyFilterInput.js.map