<ng-container *ngIf="molecularProfile$ | ngrxPush as mp">
  <!-- component layout row -->
  <nz-row [nzGutter]="[8, 16]">
    <!-- molecular profile attributes block -->
    <nz-col [nzSpan]="24">
      <nz-row [nzGutter]="[8, 8]">
        <nz-col [nzSpan]="24">
          <nz-descriptions
            nzSize="small"
            nzBordered="true"
            [nzColumn]="3"
            nzLayout="vertical">
            <nz-descriptions-item nzTitle="MP Expression">
              <cvc-mp-tag-name [nameSegments]="mp.parsedName"></cvc-mp-tag-name>
            </nz-descriptions-item>
            <ng-container *ngIf="mp.complexMolecularProfileCreationActivity">
              <nz-descriptions-item [nzTitle]="createdTitle">
                by
                <cvc-user-tag
                  [user]="
                    mp.complexMolecularProfileCreationActivity.user
                  "></cvc-user-tag>
              </nz-descriptions-item>
              <ng-template #createdTitle>
                Created
                <span
                  nz-typography
                  nzType="secondary">
                  ({{
                    mp.complexMolecularProfileCreationActivity.createdAt
                      | timeAgo
                  }})
                </span>
              </ng-template>
            </ng-container>
            <ng-container *ngIf="mp.complexMolecularProfileDeprecationActivity">
              <nz-descriptions-item [nzTitle]="deprecatedTitle">
                by
                <cvc-user-tag
                  [user]="
                    mp.complexMolecularProfileDeprecationActivity.user
                  "></cvc-user-tag>
              </nz-descriptions-item>
              <ng-template #deprecatedTitle>
                Deprecated
                <span
                  nz-typography
                  nzType="secondary">
                  ({{
                    mp.complexMolecularProfileDeprecationActivity.createdAt
                      | timeAgo
                  }})
                </span>
              </ng-template>
            </ng-container>
            <ng-container *ngIf="mp.variantDeprecationActivity">
              <nz-descriptions-item [nzTitle]="deprecatedTitle">
                by
                <cvc-user-tag
                  [user]="mp.variantDeprecationActivity.user"></cvc-user-tag>
              </nz-descriptions-item>
              <ng-template #deprecatedTitle>
                Deprecated
                <span
                  nz-typography
                  nzType="secondary">
                  ({{ mp.variantDeprecationActivity.createdAt | timeAgo }})
                </span>
              </ng-template>
            </ng-container>
          </nz-descriptions>
        </nz-col>
        <nz-col [nzSpan]="24">
          <nz-descriptions
            nzSize="small"
            nzBordered="true"
            [nzColumn]="2"
            nzLayout="vertical">
            <nz-descriptions-item nzTitle="Description">
              <p
                *ngIf="mp.description; else noDescription"
                nz-typography
                nzEllipsis
                nzExpandable
                [nzEllipsisRows]="14">
                {{ mp.description }}
              </p>

              <ng-template #noDescription>
                <cvc-empty-revisable notification="No description provided">
                </cvc-empty-revisable>
              </ng-template>
            </nz-descriptions-item>

            <nz-descriptions-item nzTitle="Sources">
              <cvc-tag-list
                *ngIf="mp.sources.length > 0; else valueUnspecified">
                <cvc-source-tag
                  *ngFor="let source of mp.sources"
                  [source]="source">
                </cvc-source-tag>
              </cvc-tag-list>
            </nz-descriptions-item>

            <!-- CIViC Score-->
            <nz-descriptions-item nzTitle="Molecular Profile Score">
              <span nz-typography>{{ mp.molecularProfileScore | number }}</span>
            </nz-descriptions-item>

            <!-- aliases -->
            <nz-descriptions-item nzTitle="Aliases">
              <cvc-tag-list
                *ngIf="
                  mp.molecularProfileAliases.length > 0;
                  else valueUnspecified
                ">
                <nz-tag *ngFor="let alias of mp.molecularProfileAliases">{{
                  alias
                }}</nz-tag>
              </cvc-tag-list>
            </nz-descriptions-item>
          </nz-descriptions>
        </nz-col>
      </nz-row>
    </nz-col>

    <!-- variant cards -->
    <nz-col nzSpan="24">
      <nz-card nzTitle="MP Variants">
        <nz-row [nzGutter]="[8, 8]">
          <nz-col
            nzSpan="24"
            *ngFor="let v of mp.variants">
            @switch (v.__typename) {
              @case ('GeneVariant') {
                <cvc-mp-gene-variant-card
                  [variant]="v"
                  [currentMolecularProfileId]="
                    mp.id
                  "></cvc-mp-gene-variant-card>
              }
              @case ('FusionVariant') {
                <cvc-mp-fusion-variant-card
                  [variant]="v"
                  [currentMolecularProfileId]="
                    mp.id
                  "></cvc-mp-fusion-variant-card>
              }
              @case ('FactorVariant') {
                <cvc-mp-factor-variant-card
                  [variant]="v"
                  [currentMolecularProfileId]="
                    mp.id
                  "></cvc-mp-factor-variant-card>
              }
            }
          </nz-col>
        </nz-row>
      </nz-card>
    </nz-col>
    <!-- evidence table -->
    <nz-col nzSpan="24">
      <cvc-evidence-table
        [molecularProfileId]="mp.id"
        [displayMolecularProfile]="false"
        cvcHeight="300px"
        cvcTitle="Evidence">
      </cvc-evidence-table>
    </nz-col>

    <!-- assertions table -->

    <nz-col nzSpan="24">
      <cvc-assertions-table
        [molecularProfileId]="mp.id"
        cvcHeight="200px"
        cvcTitle="{{ mp.name }} Assertions">
      </cvc-assertions-table>
    </nz-col>
  </nz-row>
</ng-container>
<ng-template #valueNotApplicable>
  <cvc-empty-value cvcEmptyCategory="not-applicable"></cvc-empty-value>
</ng-template>
<ng-template #valueUnspecified>
  <cvc-empty-value cvcEmptyCategory="unspecified"></cvc-empty-value>
</ng-template>
