import { Component, OnDestroy, OnInit } from '@angular/core';
import { Router, ActivatedRoute, NavigationEnd } from '@angular/router';
import { Subscription } from 'rxjs';
import { ProbeHost, Probe } from '@overflow/commons-typescript/model/probe';
import { Target } from '@overflow/commons-typescript/model/target';
import { BreadcrumbService } from '@app/commons/service/breadcrumb.service';

@Component({
  selector: 'of-pages-sensor-detail',
  templateUrl: './sensor-detail-page.component.html',
})
export class SensorDetailPageComponent implements OnInit {

  isDetail: boolean;
  sensorID: string;

  constructor(
    private router: Router,
    private route: ActivatedRoute,
    private breadcrumbService: BreadcrumbService
  ) {
  }

  ngOnInit(): void {
    this.route.params.subscribe(params => {
      this.sensorID = params['id'];
    });
  }

  onTargetSelect(target: Target) {
    this.router.navigate(['target', target.id, 'info']);
  }

  onDiscovery(probeHostID: number) {
    this.router.navigate(['discovery', probeHostID]);
  }
}
