<ng-container *ngIf="linked; else unlinked">
  <a [routerLink]="variantType.link">
    <ng-template [ngTemplateOutlet]="tag"></ng-template>
  </a>
</ng-container>

<ng-template #tag>
  <nz-tag
    nz-popover
    [nzPopoverMouseEnterDelay]="0.5"
    [nzPopoverContent]="enablePopover ? variantTypePopover : undefined">
    <ng-template [ngTemplateOutlet]="tagContent"></ng-template>
  </nz-tag>
  <ng-template #variantTypePopover>
    <cvc-variant-type-popover
      [variantTypeId]="variantType.id"></cvc-variant-type-popover>
  </ng-template>
</ng-template>

<ng-template #unlinked>
  <ng-template [ngTemplateOutlet]="tag"></ng-template>
</ng-template>

<ng-template #noPopover>
  <nz-tag>
    <ng-template [ngTemplateOutlet]="tagContent"></ng-template>
  </nz-tag>
</ng-template>

<ng-template #tagContent>
  <i
    nz-icon
    nzType="civic-varianttype"
    nzTheme="twotone"
    [nzTwotoneColor]="iconColor"></i>
  {{ variantType.name }}
</ng-template>
