import { Injectable, inject } from '@angular/core'
import { Observable, of, switchMap } from 'rxjs'
import { shareReplay } from 'rxjs/operators'
import { RecordsRepositoryInterface } from '../../../../../../libs/common/domain/src/lib/repository/records-repository.interface'

@Injectable({
  providedIn: 'root',
})
export class RecordsService {
  private recordsRepository = inject(RecordsRepositoryInterface)

  recordsCount$: Observable<number> = of(true).pipe(
    switchMap(() => this.recordsRepository.getMatchesCount({})),
    shareReplay(1)
  )
}
