import { Component, OnInit, Input } from '@angular/core';
import { PgVerticalProgressItemType } from 'app/shared/candidate-details/pg-vertical-progress/pg-vertical-progress-item-type.enum';

@Component({
  selector: 'app-pg-vertical-progress-item',
  templateUrl: './pg-vertical-progress-item.component.html',
  styleUrls: ['./pg-vertical-progress-item.component.scss']
})
export class PgVerticalProgressItemComponent implements OnInit {

  /**
   * recives an PgVerticalProgressItemType to 
   * control icons and colors.
   * Possible values are:
   * success
   * warning
   * error
   */
  @Input() state: PgVerticalProgressItemType = PgVerticalProgressItemType.EMPTY;

  private _stateIcon: string;

  /**
   * Maps state to the proper icon used for each
   * state
   */
  private stateIcons = {
    'success': 'check',
    'error':   'priority_high',
    'warning': 'priority_high',
    'empty': 'empty'
  };

  get stateIcon(): string {
    return this.stateIcons[this.state];
  }

  get isEmpty(): boolean {
    return this.state === PgVerticalProgressItemType.EMPTY;
  }

  constructor() { }

  ngOnInit() {
  }

}
