<!--
~ 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/>.
-->

<ion-header>
  <ion-toolbar color="primary" mode="ios">
    <ion-buttons slot="start">
      <ion-back-button></ion-back-button>
    </ion-buttons>
    <ion-title>{{ 'data.detail.TITLE' | translate }}</ion-title>
    <ion-buttons slot="primary">
      @if (item) {
        <stapps-favorite-button [item]="$any(item)"></stapps-favorite-button>
      }
    </ion-buttons>
  </ion-toolbar>
</ion-header>
<ion-content class="ion-no-padding">
  <div>
    @switch (true) {
      @case (!item && (isDisconnected | async)) {
        <div class="centered-message-container">
          <ion-icon name="signal_disconnected"></ion-icon>
          <ion-label> {{ 'data.detail.COULD_NOT_CONNECT' | translate }} </ion-label>
        </div>
      }
      @case (item === null) {
        <div class="centered-message-container">
          <ion-icon name="link_off"></ion-icon>
          <ion-label> {{ 'data.detail.NOT_FOUND' | translate }} </ion-label>
        </div>
      }
      @case (!item && item !== null) {
        <stapps-skeleton-list-item></stapps-skeleton-list-item>
        <stapps-skeleton-simple-card></stapps-skeleton-simple-card>
      }
      @default {
        @if (item) {
          <stapps-hebis-detail-content [item]="item"></stapps-hebis-detail-content>
        }
        @if (item) {
          <stapps-daia-availability></stapps-daia-availability>
        }
      }
    }
  </div>
</ion-content>
