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

@Component({
  selector: 'app-pgm-bny-reviewer',
  templateUrl: './pgm-bny-reviewer.component.html',
  styleUrls: ['./pgm-bny-reviewer.component.scss']
})
export class PgmBnyReviewerComponent implements OnInit {

  @Input() reviewerList;
  constructor() { }

  ngOnInit() {
  }

  getInitials(fullName: string) {
    if (fullName) {
      return fullName.replace(/\W*(\w)\w*/g, '$1').toUpperCase();
    }
  }

  getOuterStrokeColour(percent) {
    if (percent >= 65) {
      return '#3CB371';
    } else if (percent < 65 && percent >= 30) {
      return '#FF9933';
    } else if (percent < 30) {
      return '#F08080';
    }
  }
  /*SCORE TYPE CONVERSTION*/
  score(mark) {
    return  Number(mark);
  }

  getStatus(type) {
    const status = {
      'PASSED': 'Completed',
      'REJECTED': 'Invalid',
      'PENDING': 'Reviewing',
      'default': 'Invalid'
    };
    return status[type] || status['default'];
  }
}
