<!-- display full description row unless Comment type -->
<nz-row
  class="timeline-item"
  *ngIf="event.originatingObject; else noOriginating">
  <!-- default to full description -->
  <nz-col
    nzFlex="auto"
    class="description">
    <!-- user tag -->
    <cvc-user-tag
      [user]="event.originatingUser"
      *ngIf="tagDisplay != 'hideUser'"></cvc-user-tag>

    <!-- verb -->
    <span nz-typography>{{ event.action | eventVerbiage: 'feed' }}&nbsp;</span>

    <!-- originating object -->
    <ng-container *ngIf="event.originatingObject as object">
      <ng-container [ngSwitch]="object.__typename">
        <span *ngSwitchCase="'Revision'">
          <cvc-revision-tag
            [revision]="$any(object)"
            [subject]="event.subject"></cvc-revision-tag>
          <span
            nz-typography
            *ngIf="tagDisplay != 'hideSubject'"
            >{{ event.action | prepositionForSubject }}&nbsp;</span
          >
        </span>
        <span *ngSwitchCase="'Comment'">
          <cvc-comment-tag
            [comment]="object"
            [subject]="event.subject"></cvc-comment-tag>
          <span
            nz-typography
            *ngIf="tagDisplay != 'hideSubject'"
            >{{ event.action | prepositionForSubject }}&nbsp;</span
          >
        </span>
        <span *ngSwitchCase="'Flag'">
          <cvc-flag-tag
            [flag]="object"
            [subject]="event.subject"></cvc-flag-tag>
          <span
            nz-typography
            *ngIf="tagDisplay != 'hideSubject'"
            >{{ event.action | prepositionForSubject }}&nbsp;</span
          >
        </span>
        <span *ngSwitchCase="'SourceSuggestion'">
          <nz-tag
            style="cursor: pointer"
            [routerLink]="object.link">
            {{ object.name }}
          </nz-tag>
          <span
            nz-typography
            *ngIf="tagDisplay != 'hideSubject'"
            >{{ event.action | prepositionForSubject }}&nbsp;</span
          >
        </span>
      </ng-container>
    </ng-container>

    <!-- subject -->
    <ng-container
      *ngIf="tagDisplay != 'hideSubject' && event.subject as subject">
      @switch (subject.__typename) {
        @case ('Feature') {
          <cvc-feature-tag [feature]="subject"></cvc-feature-tag>
        }
        @case ('Assertion') {
          <cvc-assertion-tag [assertion]="subject"></cvc-assertion-tag>
        }
        @case ('EvidenceItem') {
          <cvc-evidence-tag [evidence]="subject"></cvc-evidence-tag>
        }
        @case ('GeneVariant') {
          <cvc-feature-variant-tag
            [variant]="subject"></cvc-feature-variant-tag>
        }
        @case ('FactorVariant') {
          <cvc-feature-variant-tag
            [variant]="subject"></cvc-feature-variant-tag>
        }
        @case ('FusionVariant') {
          <cvc-feature-variant-tag
            [variant]="subject"></cvc-feature-variant-tag>
        }
        @case ('Revision') {
          <cvc-revision-tag [revision]="$any(subject)"></cvc-revision-tag>
        }
        @case ('VariantGroup') {
          <cvc-variant-group-tag
            [variantgroup]="subject"></cvc-variant-group-tag>
        }
        @case ('Source') {
          <cvc-source-tag
            mode="concise"
            [source]="$any(subject)"></cvc-source-tag>
        }
        @case ('MolecularProfile') {
          <cvc-molecular-profile-tag
            [molecularProfile]="subject"></cvc-molecular-profile-tag>
        }
        @default {
          {{ subject.name }}
        }
      }
    </ng-container>

    <!-- user organization -->
    <ng-container *ngIf="tagDisplay != 'hideOrg' && event.organization as org">
      <span nz-typography>for&nbsp;</span>
      <cvc-organization-tag [org]="org"></cvc-organization-tag>
    </ng-container>
  </nz-col>
  <nz-col
    nzFlex="100px"
    class="timestamp">
    <span
      nz-tooltip
      nzTooltipPlacement="top"
      [nzTooltipTitle]="event.createdAt | date">
      {{ event.createdAt | timeAgo }}
    </span>
  </nz-col>
</nz-row>

<ng-template #noOriginating>
  Event database entry is malformed and cannot be displayed
</ng-template>
