import {
  useQueryParams
} from "./chunk-THHRRYRS.js";

// src/hooks/table/query/use-order-table-query.tsx
var useOrderTableQuery = ({
  prefix,
  pageSize = 20
}) => {
  const queryObject = useQueryParams(
    [
      "offset",
      "q",
      "created_at",
      "updated_at",
      "region_id",
      "sales_channel_id",
      "customer_id",
      "seller_id",
      "status",
      "payment_status",
      "fulfillment_status",
      "order"
    ],
    prefix
  );
  const {
    offset,
    sales_channel_id,
    customer_id,
    seller_id,
    status,
    created_at,
    updated_at,
    fulfillment_status,
    payment_status,
    region_id,
    q,
    order
  } = queryObject;
  const searchParams = {
    limit: pageSize,
    offset: offset ? Number(offset) : 0,
    sales_channel_id: sales_channel_id?.split(","),
    customer_id: customer_id?.split(","),
    seller_id: seller_id?.split(","),
    status: status?.split(","),
    fulfillment_status: fulfillment_status?.split(","),
    payment_status: payment_status?.split(","),
    created_at: created_at ? JSON.parse(created_at) : void 0,
    updated_at: updated_at ? JSON.parse(updated_at) : void 0,
    region_id: region_id?.split(","),
    order: order ? order : "-display_id",
    q
  };
  return {
    searchParams,
    raw: queryObject
  };
};

export {
  useOrderTableQuery
};
