import { Observable, Subject } from 'rxjs';

import {
  VirtualScrollStrategy,
  CdkVirtualScrollViewport
} from '@angular/cdk/scrolling';
import { distinctUntilChanged } from 'rxjs/operators';

export class GroupVirtualScrollStrategy implements VirtualScrollStrategy {
  scrolledIndexChange: Observable<number>;

  private indexSubject = new Subject<number>();
  private viewport: CdkVirtualScrollViewport | null = null;

  constructor() {
    this.scrolledIndexChange = this.indexSubject.pipe(distinctUntilChanged());
  }

  attach(viewport: CdkVirtualScrollViewport): void {
    this.viewport = viewport;
  }
  detach(): void {
    this.indexSubject.complete();
    this.viewport = null;
  }
  onContentScrolled(): void {}
  onDataLengthChanged(): void {}
  onContentRendered(): void {}
  onRenderedOffsetChanged(): void {}
  scrollToIndex(index: number, behavior: ScrollBehavior): void {}
}
