import type { GridColDef, GridValidRowModel } from "@mui/x-data-grid";

export const MEETING_REQUESTS_PAGE_SIZE = 10;
export const MEETING_REQUEST_COLUMN_WIDTH = 161;
export const MEETING_REQUESTS_TABLE_MIN_WIDTH = 1637;

/** Lock each column to its configured width so DataGrid does not compress columns. */
export function withFixedColumnWidths<Row extends GridValidRowModel>(
  columns: GridColDef<Row>[],
): GridColDef<Row>[] {
  return columns.map((column) => {
    const width = typeof column.width === "number" ? column.width : 120;

    return {
      ...column,
      width,
      minWidth: width,
      maxWidth: width,
      flex: 0,
      resizable: false,
    };
  });
}
