import { Component, OnInit, Input } from '@angular/core';
import { environment } from '../../../../environments/environment.dev';

@Component({
  selector: 'app-ta-dashboard-candidate-status',
  templateUrl: './ta-dashboard-candidate-status.component.html',
  styleUrls: ['./ta-dashboard-candidate-status.component.scss']
})
export class TaDashboardCandidateStatusComponent implements OnInit {

  @Input() candidate: any;

  static readonly STATUS_TEXT = {
    "ONBOARDED": "Onboarded",
    "TA_APPROVED": "Selected",
    "TA_REJECTED": "Rejected",
    "METTL_SCHEDULED": "Mettl Scheduled",
    "METTL_APPROVED": "Mettl Approved",
    "METTL_REJECTED": "Mettl Rejected",
    "METTL_REVIEW": "Mettl Review",
    "METTL_COACH_ASSIGNED": "Mettl Coach Assigned",
    "COACH_ASSIGNED": "Mini PG Initiated",
    "COACH_APPROVED": "Coach Approved",
    "COACH_REJECTED": "Coach Rejected",
    "MINI_PG_STARTED": "Mini PG Initiated",
    "MINI_PG_COMPLETED": "Mini PG Completed",
    "MINI_PG_COACH_REJECTED": "Mini PG Rejected",
    "MINI_PG_COACH_APPROVED": "Mini PG Selected",
    "MAIN_PG_STARTED": "Main PG Initiated",
    "MAIN_PG_COACH_ASSIGNED": "Main PG Initiated",
    "MAIN_PG_COMPLETED": "Main PG Completed",
    "MAIN_PG_COACH_REVIEWED": "Main PG Reviewed",
    "MAIN_PG_MANAGER_APPROVED": "Main PG Completed",
    "MAIN_PG_MANAGER_REJECTED": "Main PG Rejected"
  }

  img_path = environment.imageUrl+'/assets/img/Taflow/';

  constructor() { }

  ngOnInit() {
  }

  get icon(): string {
    if (!this.candidate) {
      return '';
    }

    switch (this.candidate.status) {
      case 'TA_REJECTED':
      case 'METTL_REJECTED':
      case 'MINI_PG_COACH_REJECTED':
      case 'MAIN_PG_MANAGER_REJECTED':
        return 'close-simple-line-icons.png';

      case 'ONBOARDED':
      case 'COACH_ASSIGNED':
      case 'MAIN_PG_COACH_ASSIGNED':
        return 'Group.png';

      default:
        return 'ion-android-checkmark-circle-Ionicons.png';
    }
  }

  get class(): string {
    if (!this.candidate) {
      return '';
    }

    switch (this.candidate.status) {
      case 'TA_REJECTED':
      case 'METTL_REJECTED':
      case 'MINI_PG_COACH_REJECTED':
      case 'MAIN_PG_MANAGER_REJECTED':
        return 'reject_status';

      case 'ONBOARDED':
      case 'COACH_ASSIGNED':
      case 'MAIN_PG_COACH_ASSIGNED':
        return 'blue_status';

      default:
        return 'green_status';
    }
  }

  get status_text() {
    return TaDashboardCandidateStatusComponent.STATUS_TEXT[this.candidate.status] || '';
  }

}
