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

let ROLES_TO_NUMBER = {
  "Coach": 3,
  "COACH": 3,
  "EMPLOYEE": 2,
  "CANDIDATE": 1
}

@Component({
  selector: 'app-chat-user-list-item',
  templateUrl: './chat-user-list-item.component.html',
  styleUrls: ['./chat-user-list-item.component.scss']
})
export class ChatUserListItemComponent implements OnInit {

  @Input() user: any;

  @Input() lastMessage: any;

  constructor() { }

  ngOnInit() {
  }

  getRoleToDisplay(roles: string[]) {
    return _.maxBy(roles, role => ROLES_TO_NUMBER[role]);
  }

}
