<div *ngIf="lookupResult" fxLayout="column" class="mt-1">
  <mat-divider class="mb-1" [inset]="true" />
  <div fxLayout="row">
    <div fxFlex="30">
      <h4 fxLayoutAlign="start" class="font-bold-500">Alias</h4>
      <span class="foreground-secondary-text">{{lookupResult.node.alias}}<span class="ml-2" [ngStyle]="{'background-color': lookupResult.node?.color}">{{lookupResult.node?.color}}</span></span>
    </div>
    <div fxFlex="70">
      <h4 fxLayoutAlign="start" class="font-bold-500">Pub Key</h4>
      <span class="foreground-secondary-text w-100">{{lookupResult.node.pub_key}}</span>
    </div>
  </div>
  <mat-divider class="my-1" [inset]="true" />
  <div fxLayout="row">
    <div fxFlex="30">
      <h4 fxLayoutAlign="start" class="font-bold-500">Last Update</h4>
      <span class="foreground-secondary-text">{{(lookupResult.node.last_update * 1000) | date:'dd/MMM/y HH:mm'}}</span>
    </div>
    <div fxFlex="70">
      <h4 fxLayoutAlign="start" class="font-bold-500">Total Capacity (Sats)</h4>
      <span class="foreground-secondary-text">{{lookupResult.total_capacity | number}}</span>
    </div>
  </div>
  <mat-divider class="my-1" [inset]="true" />
  <div fxLayout="row">
    <div fxFlex="30">
      <h4 fxLayoutAlign="start" class="font-bold-500">Number of Channels</h4>
      <span class="foreground-secondary-text">{{lookupResult.num_channels | number}}</span>
    </div>
    <div fxLayout="column" fxFlex="70" fxLayoutAlign="end start" class="my-1">
      <h4 fxLayoutAlign="start" class="font-bold-500">Features</h4>
      <span *ngFor="let feature of lookupResult.node.features | keyvalue" class="foreground-secondary-text w-100">{{nodeFeaturesEnum[feature.value.name] || feature.value.name}}: {{feature.value.is_required ? 'Mandatory' : 'Optional'}}</span>
    </div>
  </div>
  <mat-divider class="my-1" [inset]="true" />
  <div fxLayout="column">
    <h4 fxFlex="100" fxLayoutAlign="start" class="font-bold-500 mb-1">Addresses</h4>
    <div fxLayout="row" fxFlex="100" class="table-container" [perfectScrollbar]>
      <table #table mat-table matSort [dataSource]="lookupResult.node.addresses">
        <ng-container matColumnDef="network">
          <th *matHeaderCellDef mat-header-cell mat-sort-header>Network</th>
          <td *matCellDef="let address" mat-cell>{{address?.network}}</td>
        </ng-container>
        <ng-container matColumnDef="addr">
          <th *matHeaderCellDef mat-header-cell mat-sort-header>Address</th>
          <td *matCellDef="let address" mat-cell>{{address?.addr}}</td>
        </ng-container>
        <ng-container matColumnDef="actions">
          <th *matHeaderCellDef mat-header-cell>
            <div class="bordered-box table-actions-select btn-action" fxLayoutAlign="center center">Actions</div>
         </th>
         <td *matCellDef="let address" mat-cell fxLayoutAlign="end center">
          <div class="bordered-box table-actions-select" fxLayoutAlign="center center">
            <mat-select placeholder="Actions" tabindex="1" class="mr-0">
              <mat-select-trigger />
              <mat-option (click)="onConnectNode(address)">Connect</mat-option>
              <mat-option rtlClipboard [payload]="lookupResult.node.pub_key + '@' + address.addr" (copied)="onCopyNodeURI(address)">Copy URI</mat-option>
            </mat-select>
          </div>
        </td>
        </ng-container>
        <tr *matHeaderRowDef="displayedColumns;" mat-header-row></tr>
        <tr *matRowDef="let row; columns: displayedColumns;" mat-row></tr>        
      </table>
    </div>
  </div>
</div>
