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

import { Subscription } from 'rxjs/Subscription';
import {Probe, ProbeHost} from '@overflow/commons-typescript/model/probe';

@Component({
  selector: 'of-probe-selector',
  templateUrl: './probe-selector.component.html',
})
export class ProbeSelectorComponent implements OnInit, AfterContentInit, OnDestroy {

  @Input() preProbe: ProbeHost;
  probes: Probe[];
  selected: Probe;

  @Output() probeSelected = new EventEmitter<Probe>();

  constructor(
  ) {
  }

  ngOnInit() {

  }

  ngAfterContentInit() {
    this.getProbes();
  }

  ngOnDestroy() {
    this.selected = null;
    this.probes = null;
  }

  getProbes() {

  }

  onProbeSelect(event) {
    this.selected = event.value;
    this.probeSelected.emit(this.selected);
  }

  registerOnChange(fn: any): void {
  }

  registerOnTouched(fn: any): void {
  }

  setDisabledState(isDisabled: boolean): void {
  }

  writeValue(obj: any): void {
  }

}
