<div id="popover-content">
  <ng-container *ngIf="revision$ | ngrxPush as r">
    <nz-card
      [nzTitle]="cardTitle"
      [nzExtra]="subject"
      nzBordered="false"
      id="card-content">
      <ng-template #cardTitle>
        <nz-space class="revision-card-title">
          <span *nzSpaceItem>
            <i
              nz-icon
              nzTheme="twotone"
              [nzTwotoneColor]="'Revision' | entityColor"
              nzType="civic-revision"></i>
            RID{{ r.id }}
          </span>
          <cvc-status-tag
            [status]="r.status"
            *nzSpaceItem></cvc-status-tag>
        </nz-space>
      </ng-template>

      <ng-template #subject>
        @switch (r.subject.__typename) {
          @case ('Feature') {
            <cvc-feature-tag
              [enablePopover]="false"
              [feature]="r.subject"></cvc-feature-tag>
          }
          @case ('Assertion') {
            <cvc-assertion-tag
              [enablePopover]="false"
              [assertion]="r.subject"></cvc-assertion-tag>
          }
          @case ('EvidenceItem') {
            <cvc-evidence-tag
              [enablePopover]="false"
              [evidence]="r.subject"></cvc-evidence-tag>
          }
          @case ('Variant') {
            <cvc-feature-variant-tag
              [enablePopover]="false"
              [variant]="r.subject"></cvc-feature-variant-tag>
          }
          @case ('VariantGroup') {
            <cvc-variant-group-tag
              [enablePopover]="false"
              [variantgroup]="r.subject"></cvc-variant-group-tag>
          }
          @default {
            {{ r.subject.name }}
          }
        }
      </ng-template>

      <nz-descriptions
        nzBordered
        [nzColumn]="1"
        nzSize="small">
        <nz-descriptions-item nzTitle="Revisor">
          <cvc-user-tag
            *ngIf="r.creationActivity?.user"
            [enablePopover]="false"
            [user]="r.creationActivity!.user"></cvc-user-tag>
        </nz-descriptions-item>
        <nz-descriptions-item nzTitle="Field">
          {{ r.linkoutData.name }}
        </nz-descriptions-item>
        <nz-descriptions-item nzTitle="Revision Date">
          {{ r.createdAt | timeAgo }}
        </nz-descriptions-item>
        <nz-descriptions-item *ngIf="r.creationActivity?.parsedNote" nzTitle="Creation Comment">
          <cvc-comment-body [commentBodySegments]="r.creationActivity!.parsedNote"></cvc-comment-body>
        </nz-descriptions-item>
      </nz-descriptions>
    </nz-card>
  </ng-container>
</div>
