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

@Component({
  selector: 'two-option-select',
  templateUrl: './two-option-select.component.html',
  styleUrls: ['./two-option-select.component.scss'],
})
export class TwoOptionSelectComponent implements OnInit {

  @Input() isOption1 = false;
  @Input() isOption2 = false;
  @Input() option1: string;
  @Input() option2: string;
  @Input() label: string;
  value: number;
  @Output() selected = new EventEmitter();

  constructor() {
  }

  select(cond: boolean) {
    if (cond) {
      this.isOption1 = true;
      this.isOption2 = false;
      this.value = 1;
      this.selected.emit(this.value);
    } else {
      this.isOption1 = false;
      this.isOption2 = true;
      this.value = 2;
      this.selected.emit(this.value);
    }
  }
  ngOnInit() {

  }

}
