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: 'set-role-list',
  templateUrl: './set-role-list.component.html',
  styleUrls: ['./set-role-list.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush
})
export class SetRoleListComponent extends BaseList implements OnInit,OnChanges {
  @Input() roleList: any = [];
  @Output() delete = new EventEmitter()
  column = ['4','1','2','3']
  constructor(
    private router: Router
  ) {
    super()
   }

  ngOnInit(): void {
  }

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

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

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

}
