import { Component, OnInit, Input } from '@angular/core';

import { InstructorData } from '../../../structures/instructor-data';

import { InstructorService } from '../../../services/instructor.service';

import * as Globals from '../../../globals';

@Component({
  selector: 'app-instructor-profile-approve-table',
  templateUrl: './instructor-profile-approve-table.component.html',
  styleUrls: ['./instructor-profile-approve-table.component.scss']
})
export class InstructorProfileApproveTableComponent implements OnInit {

  @Input() instructors: InstructorData[] = [];

  profileLink: string = Globals.pages.instructorProfile.path;

  displayedColumns: string[] = ['name', 'email', 'age', 'city', 'link', 'decision'];

  constructor(private instructorService: InstructorService) { }

  ngOnInit(): void {
  }

  approveInstructorProfile(instructor: InstructorData) {
    this.instructorService.changeInstructorRole(instructor.ID, 'instruktor')
  }

  denyInstructorProfile(instructor: InstructorData) {
    this.instructorService.changeInstructorRole(instructor.ID, 'blokovany')
  }

}
