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

@Component({
  selector: 'app-candidate-report-table',
  templateUrl: './candidate-report-table.component.html',
  styleUrls: ['./candidate-report-table.component.scss'],
  encapsulation: ViewEncapsulation.None
})
export class CandidateReportTableComponent implements OnInit {

  @Input() list: any;

  statusJson =
    {
      METTL_INITIATED: 'Initiated',
      METTL_IN_PROGRESS: 'In progress',
      METTL_REVIEW: 'Onhold',
      METTL_FAILED: 'Rejected',

      METTL_CLEARED: 'Awaiting Initiation',
      CODING_CHALLENGE_READY: 'Awaiting Initiation',
      CODING_CHALLENGE_INITIATED: 'Initiated',
      CODING_CHALLENGE_STARTED: 'In progress',
      CODING_CHALLENGE_COMPLETED: 'Onhold',
      CODING_CHALLENGE_REJECTED: 'Rejected',

      CODING_CHALLENGE_CLEARED: 'Discussion in progress',
      WHITEBOARD_READY: 'Discussion in progress',
      WHITEBOARD_INITIATED: 'Onhold',
      WHITEBOARD_REJECTED: 'Rejected',

      WHITEBOARD_CLEARED: 'In progress',
      LEADERSHIP_CONNECT_READY: 'In progress',
      LEADERSHIP_CONNECT_REJECTED: 'Rejected',
      LEADERSHIP_CONNECT_CLEARED: 'Selected',
    }

  constructor() {

  }

  ngOnInit() {
    _.each(this.list, (element) => {
      element.status = this.statusJson[element.status];
    });
  }

  getStatus(sts) {
    return this.statusJson[sts];
  }

}

