import { Component, OnInit, ChangeDetectionStrategy, Input, OnChanges, Output, EventEmitter } from '@angular/core';
import { Router } from '@angular/router';
import { BaseList } from 'src/app/core/base/base-list';

@Component({
  selector: 'app-list',
  templateUrl: './list.component.html',
  styleUrls: ['./list.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class ListComponent extends BaseList implements OnInit,OnChanges {
  @Input() userList: any = [];
  @Output() delete = new EventEmitter()
  column = ['4','0','1','2','3']
  constructor(
    private router: Router
  ) {
    super()
   }

  ngOnInit(): void {
  }

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

  onEdit(id){
    this.router.navigate(['create-user/edit',id])
  }

  onDelete(id){
    this.delete.emit(id)
  }

}
