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

@Component({
  selector: 'app-coach-candidate-card',
  templateUrl: './coachcandidatecard.component.html',
  styleUrls: ['./coachcandidatecard.component.css']
})
export class CoachcandidatecardComponent implements OnInit {

  @Input() candidate:any;
  @Input() approval:string;
  @Output() candidateID = new EventEmitter<string>();
  @Output() scheduleId = new EventEmitter<string>();
  @Output() approve = new EventEmitter<string>();
  @Output() reject = new EventEmitter<string>();




  constructor() { }

  ngOnInit() {
    console.log(this.approval);
    if(!this.approval){
      this.approval = 'hide';
    }
  }

  Selected(ID) {
    this.candidateID.emit(ID);
  }

  schedule(ID){
    this.scheduleId.emit(ID);
  }

  Approve(decision, status){
    console.log("status,status ",status);
    if( status == "METTL_REVIEW" && decision == "show"){

      console.log('METTL_REVIEW',decision);
      this.approval = decision;

    }
    else if (decision == 'hide'){
      this.approval = decision;
      console.log('METTL_REVIEW no hide');
    }


  }
  confirmApprove(id){

    this.approve.emit(id);
    console.log("confirm approve");
  }
  confirmReject(id){
    this.reject.emit(id)
  }

}
