import { serializeExport } from "@open-mercato/shared/lib/crud/exporters";
function buildEntitiesCsv(rows, options) {
  const includeSidebar = options?.includeSidebar ?? false;
  const columns = [
    { field: "entityId", header: "entityId" },
    { field: "label", header: "label" },
    { field: "source", header: "source" },
    { field: "count", header: "count" }
  ];
  if (includeSidebar) columns.push({ field: "showInSidebar", header: "showInSidebar" });
  const prepared = {
    columns,
    rows: rows.map((row) => ({
      entityId: row.entityId,
      label: row.label,
      source: row.source,
      count: row.count,
      ...includeSidebar ? { showInSidebar: row.showInSidebar || false } : {}
    }))
  };
  return serializeExport(prepared, "csv").body;
}
export {
  buildEntitiesCsv
};
//# sourceMappingURL=entitiesCsvExport.js.map
