/**
 * Default labels for UiDataTable components.
 * Override these by passing custom labels to component props.
 */

/** TanStack Table's default column size - columns without explicit size use this value */
export const DEFAULT_COLUMN_SIZE = 150;

export const DATA_TABLE_LABELS = {
  /** UiDataTable */
  emptyText: 'No results.',

  /** UiDataTableColumnHeader */
  sortAscending: 'Asc',
  sortDescending: 'Desc',
  sortedAscending: 'sorted ascending',
  sortedDescending: 'sorted descending',
  clickToSort: 'click to sort',

  /** UiDataTablePagination */
  rowsPerPage: 'Rows per page',
  goToFirstPage: 'Go to first page',
  goToPreviousPage: 'Go to previous page',
  goToNextPage: 'Go to next page',
  goToLastPage: 'Go to last page',
  pageOf: (page: number, total: number) => `Page ${page} of ${total}`,
  rowsSelected: (selected: number, total: number) =>
    `${selected} of ${total} row(s) selected.`,

  /** UiDataTableColumnFilter */
  columns: 'Columns',
  toggleColumns: 'Toggle columns',
  columnVisibility: 'Column visibility',
} as const;

export type DataTableLabels = typeof DATA_TABLE_LABELS;

/** Labels for UiDataTableColumnHeader */
export interface ColumnHeaderLabels {
  /** Label for ascending sort menu item */
  sortAscending?: string;
  /** Label for descending sort menu item */
  sortDescending?: string;
  /** Aria label suffix when sorted ascending */
  sortedAscending?: string;
  /** Aria label suffix when sorted descending */
  sortedDescending?: string;
  /** Aria label suffix when not sorted */
  clickToSort?: string;
}

/** Labels for UiDataTablePagination */
export interface PaginationLabels {
  /** Label for rows per page selector */
  rowsPerPage?: string;
  /** Aria label for first page button */
  goToFirstPage?: string;
  /** Aria label for previous page button */
  goToPreviousPage?: string;
  /** Aria label for next page button */
  goToNextPage?: string;
  /** Aria label for last page button */
  goToLastPage?: string;
  /** Function to generate page info text */
  pageOf?: (page: number, total: number) => string;
  /** Function to generate selection count text */
  rowsSelected?: (selected: number, total: number) => string;
}

/** Labels for UiDataTableColumnFilter */
export interface ColumnFilterLabels {
  /** Visible label for the trigger button. */
  columns?: string;
  /** Accessible label for the trigger button. */
  toggleColumns?: string;
  /** Dropdown section label. */
  columnVisibility?: string;
}
