import { Component, OnInit, ChangeDetectionStrategy, Input, OnChanges } from '@angular/core';
import { Router } from '@angular/router';
import { Subject } from 'rxjs';
import { BaseList } from 'src/app/core/base/base-list';
import { RandomQuestionsService } from 'src/app/core/service/testing-information/random-questions.service';

@Component({
  selector: 'random-questions-list',
  templateUrl: './random-questions-list.component.html',
  styleUrls: ['./random-questions-list.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class RandomQuestionsListComponent extends BaseList implements OnInit,OnChanges {
  column = [
    '1',
    '2',
    'testing_information_code',
    'testing_information_name',
    '5',
    'academic_semester_code',
    'academic_year_code',
    'created_by',
    'created_datetime'
  ];
  @Input() testingInformationList: any = [];
  private reload: boolean;
  constructor(
    private router: Router,
  ) {
    super()
   }

  ngOnInit(): void {
    this.reload = false;
    setTimeout(() => {
      this.reload = true;
    }, 2000);
  }

  ngOnChanges(){
    this.testingInformationList = this.updateMatTable(this.testingInformationList? this.testingInformationList:[])
  }

  onEdit(id){
    this.router.navigate(['/random-questions/',id])
  }

}
