<div fxLayout="column" *ngIf="lookupResult" class="mt-1">
  <mat-divider [inset]="true" class="mb-1"></mat-divider>
  <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 [inset]="true" class="my-1"></mat-divider>
  <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 [inset]="true" class="my-1"></mat-divider>
  <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 class="foreground-secondary-text w-100" *ngFor="let feature of lookupResult.node.features | keyvalue">{{nodeFeaturesEnum[feature.value.name] || feature.value.name}}: {{feature.value.is_required ? 'Mandatory' : 'Optional'}}</span>
    </div>
  </div>
  <mat-divider [inset]="true" class="my-1"></mat-divider>
  <div fxLayout="column">
    <h4 fxFlex="100" fxLayoutAlign="start" class="font-bold-500 mb-1">Addresses</h4>
    <div [perfectScrollbar] fxLayout="row" fxLayoutAlign="start center" fxFlex="100" class="table-container">
      <table mat-table #table [dataSource]="lookupResult.node.addresses" matSort>
        <ng-container matColumnDef="network">
          <th mat-header-cell *matHeaderCellDef mat-sort-header>Network</th>
          <td mat-cell *matCellDef="let address"> {{address?.network}} </td>
        </ng-container>
        <ng-container matColumnDef="addr">
          <th mat-header-cell *matHeaderCellDef mat-sort-header>Address</th>
          <td mat-cell *matCellDef="let address"> {{address?.addr}} </td>
        </ng-container>
        <ng-container matColumnDef="actions">
          <th mat-header-cell *matHeaderCellDef class="pl-1"><span fxLayoutAlign="end center">Actions</span></th>
          <td mat-cell *matCellDef="let address" class="pl-1">
            <span fxLayoutAlign="end center">
              <button mat-stroked-button color="primary" type="button" tabindex="1" rtlClipboard [payload]="lookupResult.node.pub_key + '@' + address.addr" (copied)="onCopyNodeURI($event)">Copy Node URI</button>          
            </span>
          </td>
        </ng-container>
        <tr mat-header-row *matHeaderRowDef="displayedColumns;"></tr>
        <tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>        
      </table>
    </div>
  </div>
</div>
