import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import { Side } from './model';

@Component({
  selector: 'lib-small-double-choice-switch',
  templateUrl: './small-double-choice-switch.component.html',
  styleUrls: ['./small-double-choice-switch.component.scss'],
})
export class SmallDoubleChoiceSwitchComponent implements OnInit {
  @Input() leftValue: string;
  @Input() rightValue: string;
  @Input() selectedSide: Side = Side.LEFT;
  @Input() defaultBgColor = '#9cb1c6';
  @Input() switchColor = '#1f466c';
  @Output() switch = new EventEmitter<Side>();
  constructor() {}

  ngOnInit() {}

  switchPressed() {
    if (this.selectedSide === Side.LEFT) {
      this.selectedSide = Side.RIGHT;
    } else {
      this.selectedSide = Side.LEFT;
    }
    this.switch.emit(this.selectedSide);
  }
}
