<!--
  ~ Copyright (C) 2022 StApps
  ~ This program is free software: you can redistribute it and/or modify it
  ~ under the terms of the GNU General Public License as published by the Free
  ~ Software Foundation, version 3.
  ~
  ~ This program is distributed in the hope that it will be useful, but WITHOUT
  ~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  ~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  ~ more details.
  ~
  ~ You should have received a copy of the GNU General Public License along with
  ~ this program. If not, see <https://www.gnu.org/licenses/>.
  -->

<ng-container>
  <ion-card>
    <ion-card-header>
      {{ 'hebisSearch.daia.availability' | translate }}
    </ion-card-header>
    <ion-card-content>
      <ng-container *ngIf="holdingsByDepartments">
        <ng-container *ngFor="let holdingsByDepartment of holdingsByDepartments | keyvalue">
          <ion-label>
            <stapps-external-link
              *ngIf="holdingsByDepartment.value[0].department.href"
              [text]="holdingsByDepartment.value[0].department.content"
              [link]="holdingsByDepartment.value[0].department.href"
            >
            </stapps-external-link>
          </ion-label>
          <ng-container *ngFor="let holding of holdingsByDepartment.value">
            <stapps-daia-holding [holding]="holding"></stapps-daia-holding>
          </ng-container>
        </ng-container>
      </ng-container>
      <ion-label *ngIf="!holdings">
        {{ 'hebisSearch.daia.unavailableAvailability' | translate }}
      </ion-label>
      <ion-label *ngIf="holdings?.length === 0">
        {{ 'hebisSearch.daia.unknownAvailability' | translate }}
      </ion-label>
    </ion-card-content>
  </ion-card>
</ng-container>
