import { Component, OnInit, ChangeDetectionStrategy } from '@angular/core';
import { Observable } from 'rxjs';
import { TestingInformationService } from 'src/app/core/service/testing-information/testing-information.service';

@Component({
  selector: 'app-random-questions',
  templateUrl: './random-questions.container.html',
  styleUrls: ['./random-questions.container.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class RandomQuestionsContainer implements OnInit {
  testingInformation$ = new Observable()
  constructor(
    private testingInfoSV: TestingInformationService
  ) { }

  ngOnInit(): void {
    this.testingInformation$ = this.testingInfoSV.getAll()
  }

  search(query){
    if(query) return this.testingInformation$ = this.testingInfoSV.search(`?${query}`)
    if(!query) return this.testingInformation$ = this.testingInfoSV.getAll()
  }

}
