class UserColors {
  constructor() {
    this.colors = ["#F6511D", "#FFB400", "#00A6ED", "#7FB800", "#0D2C54"];
    this.i = 0;

    this.map = new Map();
  }

  getColor(userId) {
    let color = this.map.get(userId);
    if (color === undefined) {
      color = this.colors[this.i++];
      this.map.set(userId, color);
    }
    return color;
  }
}

module.exports = { UserColors };