<div fxLayout="column" fxLayout.gt-sm="row" fxLayoutAlign="space-between stretch">
  <div fxFlex="100">
    <mat-card-header fxLayout="row" fxLayoutAlign="space-between center" class="modal-info-header">
      <div fxFlex="95" fxLayoutAlign="start start">
        <fa-icon [icon]="faReceipt" class="page-title-img mr-1"></fa-icon>
        <span class="page-title">Channel Information</span>
      </div>
      <button tabindex="3" fxFlex="5" fxLayoutAlign="center" class="btn-close-x p-0" (click)="onClose()" mat-button>X</button>
    </mat-card-header>
    <mat-card-content class="padding-gap-x-large" [ngClass]="{'xs-scroll-y': screenSize === screenSizeEnum.XS}">
      <div fxLayout="column">
        <div fxLayout="row">
          <div fxFlex="50">
            <h4 fxLayoutAlign="start" class="font-bold-500">Channel ID</h4>
            <span class="foreground-secondary-text">{{channel.chan_id}}</span>
          </div>
          <div fxFlex="50">
            <h4 fxLayoutAlign="start" class="font-bold-500">Peer Alias</h4>
            <span class="foreground-secondary-text">{{channel.remote_alias}}</span>
          </div>
        </div>
        <mat-divider [inset]="true" class="my-1"></mat-divider>
        <div fxLayout="row">
          <div fxFlex="100">
            <h4 fxLayoutAlign="start" class="font-bold-500">Channel Point</h4>
            <span class="foreground-secondary-text">{{channel.channel_point}}</span>
          </div>
        </div>
        <mat-divider [inset]="true" class="my-1"></mat-divider>
        <div fxLayout="row">
          <div fxFlex="100">
            <h4 fxLayoutAlign="start" class="font-bold-500">Peer Public Key</h4>
            <span class="foreground-secondary-text">{{channel.remote_pubkey}}</span>
          </div>
        </div>
        <mat-divider [inset]="true" class="my-1"></mat-divider>
        <div fxLayout="row">
          <div fxFlex="25">
            <h4 fxLayoutAlign="start" class="font-bold-500">Local Balance</h4>
            <span class="overflow-wrap foreground-secondary-text">{{channel.local_balance | number}}</span>
          </div>
          <div fxFlex="25">
            <h4 fxLayoutAlign="start" class="font-bold-500">Remote Balance</h4>
            <span class="overflow-wrap foreground-secondary-text">{{channel.remote_balance | number}}</span>
          </div>
          <div fxFlex="25">
            <h4 fxLayoutAlign="start" class="font-bold-500">Capacity</h4>
            <span class="overflow-wrap foreground-secondary-text">{{channel.capacity | number}}</span>
          </div>
          <div fxFlex="25">
            <h4 fxLayoutAlign="start" class="font-bold-500">Uptime (Seconds)</h4>
            <span class="overflow-wrap foreground-secondary-text">{{channel.uptime | number}}</span>
          </div>
        </div>
        <mat-divider [inset]="true" class="my-1"></mat-divider>
        <div fxLayout="row">
          <div fxFlex="25">
            <h4 fxLayoutAlign="start" class="font-bold-500">Active</h4>
            <span class="overflow-wrap foreground-secondary-text">{{channel.active ? 'Yes' : 'No'}}</span>
          </div>
          <div fxFlex="25">
            <h4 fxLayoutAlign="start" class="font-bold-500">Private</h4>
            <span class="overflow-wrap foreground-secondary-text">{{channel.private ? 'Yes' : 'No'}}</span>
          </div>
          <div fxFlex="25">
            <h4 fxLayoutAlign="start" class="font-bold-500">Initiator</h4>
            <span class="overflow-wrap foreground-secondary-text">{{channel.initiator ? 'Yes' : 'No'}}</span>
          </div>
          <div fxFlex="25">
            <h4 fxLayoutAlign="start" class="font-bold-500">Number of Updates</h4>
            <span class="overflow-wrap foreground-secondary-text">{{channel.num_updates | number}}</span>
          </div>
        </div>
        <mat-divider [inset]="true" class="my-1"></mat-divider>
        <div *ngIf="showAdvanced">
          <div fxLayout="row">
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">Commit Fee</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.commit_fee | number}}</span>
            </div>
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">Commit Weight</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.commit_weight | number}}</span>
            </div>
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">Fee/KW</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.fee_per_kw | number}}</span>
            </div>
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">Static Remote Key</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.static_remote_key ? 'Yes' : 'No'}}</span>
            </div>
          </div>
          <mat-divider [inset]="true" class="my-1"></mat-divider>
          <div fxLayout="row">
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">{{screenSize === screenSizeEnum.XS ? 'Total Sats Sent' : 'Total Satoshis Sent'}}</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.total_satoshis_sent | number}}</span>
            </div>
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">{{screenSize === screenSizeEnum.XS ? 'Total Sats Recv' : 'Total Satoshis Received'}}</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.total_satoshis_received | number}}</span>
            </div>
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">Unsettled Balance</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.unsettled_balance | number}}</span>
            </div>
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">CSV Delay</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.csv_delay | number}}</span>
            </div>
          </div>
          <mat-divider [inset]="true" class="my-1"></mat-divider>
          <div fxLayout="row">
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">Local Reserve (Sats)</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.local_chan_reserve_sat | number}}</span>
            </div>
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">Remote Reserve (Sats)</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.remote_chan_reserve_sat | number}}</span>
            </div>
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">Lifetime (Seconds)</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel.lifetime | number}}</span>
            </div>
            <div fxFlex="25">
              <h4 fxLayoutAlign="start" class="font-bold-500">Pending HTLCs</h4>
              <span class="overflow-wrap foreground-secondary-text">{{channel?.pending_htlcs?.length | number}}</span>
            </div>
          </div>
          <mat-divider [inset]="true" class="my-1"></mat-divider>
        </div>
        <div class="mt-1" fxLayout="row" fxLayoutAlign="end center" fxFlex="100">
          <button mat-button color="primary" type="reset" (click)="onShowAdvanced()" tabindex="1" class="mr-1">
            <p *ngIf="!showAdvanced; else hideAdvancedText">Show Advanced</p>
            <ng-template #hideAdvancedText><p>Hide Advanced</p></ng-template>
          </button>
          <button *ngIf="showCopy" autoFocus mat-button color="primary" tabindex="2" type="submit" rtlClipboard [payload]="channel.chan_id" (copied)="onCopyChanID($event)">Copy Channel ID</button>
          <button *ngIf="!showCopy" autoFocus mat-button color="primary" tabindex="2" type="button" (click)="onClose()">OK</button>
        </div>
      </div>
    </mat-card-content>
  </div>
</div>
