class Playbook::PbAdvancedTable::TableHeader

def wrap_leaf_columns(column_definitions)

def wrap_leaf_columns(column_definitions)
  max_depth = compute_max_depth(column_definitions)
  column_definitions.map do |col|
    if col.key?(:columns)
      {
        label: col[:label],
        columns: wrap_leaf_columns(col[:columns]),
      }
    else
      # For leaf columns, wrap with empty labels up to max depth to get proper structure
      wrap_leaf_column(col, max_depth)
    end
  end
end