import { BehaviorSubject, combineLatest, defer } from 'rxjs';
import { shareReplay, switchMap } from 'rxjs/operators';

import { ClaimsService } from '@dsh/api/claims';

@Injectable()
export class ClaimService {
    claim$ = combineLatest([this.route.params, defer(() => this.loadClaim$)]).pipe(
        switchMap(([{ claimID }]) => this.claimsService.getClaimByID(claimID)),