import { Component, Input } from '@angular/core';
import { Host, DiscoverHost } from '@overflow/model/discovery';
import { ProbeService, requesterID } from '../service/probe.service';
import { RPCSubscriber } from '@overflow/commons/ui/decorator/RPCSubscriber';


@Component({
  selector: 'app-host-detail',
  templateUrl: './host-detail.component.html',
  styleUrls: ['./host-detail.component.scss'],
})
export class HostDetailComponent {

  @Input() host: Host;

  constructor(
    private probeService: ProbeService
  ) {
  }

  ping() {
    console.log(this.host);
    // const discoverHost: DiscoverHost = {
    //   discoveryConfig: {},
    //   metaIPType: this.host.metaIPType,
    //   firstScanRange: this.host.address,
    //   lastScanRange: this.host.address,
    //   discoverPort: null,
    // };
    // this.probeService.send('DiscoveryService.DiscoverHost', requesterID, this.host.zone, discoverHost);
  }

  // @RPCSubscriber({ method: 'DiscoveryService.DiscoveredHost' })
  // public DiscoveredHost(host: Host) {
  //   console.log(host);
  // }
}
