function dateToIso(value) {
  if (value instanceof Date) return value.toISOString();
  if (typeof value === "string") return value;
  return (/* @__PURE__ */ new Date()).toISOString();
}
function optionalDateToIso(value) {
  if (value == null) return null;
  return dateToIso(value);
}
function serializePendingActionForClient(row) {
  return {
    id: row.id,
    agentId: row.agentId,
    toolName: row.toolName,
    status: row.status,
    fieldDiff: Array.isArray(row.fieldDiff) ? row.fieldDiff : [],
    records: Array.isArray(row.records) && row.records.length > 0 ? row.records : null,
    failedRecords: Array.isArray(row.failedRecords) && row.failedRecords.length > 0 ? row.failedRecords : null,
    sideEffectsSummary: row.sideEffectsSummary ?? null,
    attachmentIds: Array.isArray(row.attachmentIds) ? row.attachmentIds : [],
    targetEntityType: row.targetEntityType ?? null,
    targetRecordId: row.targetRecordId ?? null,
    recordVersion: row.recordVersion ?? null,
    queueMode: row.queueMode ?? "inline",
    executionResult: row.executionResult ?? null,
    createdAt: dateToIso(row.createdAt),
    expiresAt: dateToIso(row.expiresAt),
    resolvedAt: optionalDateToIso(row.resolvedAt),
    resolvedByUserId: row.resolvedByUserId ?? null
  };
}
export {
  serializePendingActionForClient
};
//# sourceMappingURL=pending-action-client.js.map
