interface CursorPagerProps {
  label?: string;
  isFetching: boolean;
  nextCursor: string | null;
  onNext: () => void;
  onPrevious: () => void;
  pageNumber: number;
  previousCount: number;
  rangeLabel?: string;
}

export function CursorPager({
  label,
  isFetching,
  nextCursor,
  onNext,
  onPrevious,
  pageNumber,
  previousCount,
  rangeLabel
}: CursorPagerProps) {
  return (
    <div className="cursor-pager" aria-label="Cursor pagination">
      <button disabled={isFetching || previousCount === 0} onClick={onPrevious} type="button">Previous</button>
      <span>
        {label ?? `Page ${pageNumber}`}
        {rangeLabel ? <small>{rangeLabel}</small> : null}
      </span>
      <button disabled={isFetching || !nextCursor} onClick={onNext} type="button">Next</button>
    </div>
  );
}
