import {
  useRegions
} from "./chunk-W5UPPL3W.js";
import {
  useSalesChannels
} from "./chunk-N4JU7GWK.js";

// src/hooks/table/filters/use-order-table-filters.tsx
import { useTranslation } from "react-i18next";
var useOrderTableFilters = () => {
  const { t } = useTranslation();
  const { regions } = useRegions({
    limit: 1e3,
    fields: "id,name"
  });
  const { sales_channels } = useSalesChannels({
    limit: 1e3,
    fields: "id,name"
  });
  let filters = [];
  if (regions) {
    const regionFilter = {
      key: "region_id",
      label: t("fields.region"),
      type: "select",
      options: regions.map((r) => ({
        label: r.name,
        value: r.id
      })),
      multiple: true,
      searchable: true
    };
    filters = [...filters, regionFilter];
  }
  if (sales_channels) {
    const salesChannelFilter = {
      key: "sales_channel_id",
      label: t("fields.salesChannel"),
      type: "select",
      multiple: true,
      searchable: true,
      options: sales_channels.map((s) => ({
        label: s.name,
        value: s.id
      }))
    };
    filters = [...filters, salesChannelFilter];
  }
  const dateFilters = [
    { label: "Created At", key: "created_at" },
    { label: "Updated At", key: "updated_at" }
  ].map((f) => ({
    key: f.key,
    label: f.label,
    type: "date"
  }));
  filters = [
    ...filters,
    // TODO: enable when Payment, Fulfillments <> Orders are linked
    // paymentStatusFilter,
    // fulfillmentStatusFilter,
    ...dateFilters
  ];
  return filters;
};

export {
  useOrderTableFilters
};
