// src/app/shared/paging/paging.models.ts
export type SortDir = 'asc' | 'desc' | '';

export interface ListParams {
  page: number; // 1-based for UI
  size: number;
  search?: string;
  sortKey?: string;
  sortDir?: SortDir;
  extra?: Record<string, any>;
}

export interface PageMeta {
  pageNumber: number; // 1-based
  pageSize: number;
  total: number; // -1 if unknown
}

export interface PagedResult<T> {
  content: T[];
  pageable: PageMeta;
  totalPages: number;
  totalElements: number;
}

export interface BackendConfig {
  pageParam?: string; // default 'page' (Spring is 0-based)
  sizeParam?: string; // default 'size'
  searchParam?: string; // default 'q'
  zeroBasedPageIndex?: boolean; // default true (Spring)
  buildSort?: (key?: string, dir?: SortDir) => [param: string, value: string] | null;
  mapClientSortKey?: (key?: string) => string | undefined;
}
