<!--
  ~ 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-card *ngIf="item.sameAs">
  <ion-card-header>{{ 'hebisSearch.detail.title' | translate | sentencecase }}</ion-card-header>
  <ion-card-content>
    <stapps-external-link [text]="'name' | thingTranslate : item" [link]="item.sameAs"></stapps-external-link>
  </ion-card-content>
</ion-card>

<stapps-simple-card
  *ngIf="!item.sameAs"
  [title]="'name' | propertyNameTranslate : item | sentencecase"
  [content]="'name' | thingTranslate : item"
>
</stapps-simple-card>

<stapps-simple-card
  *ngIf="item.description"
  [title]="'hebisSearch.detail.description' | translate | sentencecase"
  [content]="item.description"
></stapps-simple-card>

<stapps-simple-card
  *ngIf="item.sourceOrganization"
  [title]="'sourceOrganization' | propertyNameTranslate : item | sentencecase"
  [content]="item.sourceOrganization"
></stapps-simple-card>

<ion-card *ngIf="item.authors && item.authors.length > 0">
  <ion-card-header>{{ 'authors' | propertyNameTranslate : item | sentencecase }}</ion-card-header>
  <ion-card-content>
    <ion-label *ngFor="let author of item.authors">{{ 'name' | thingTranslate : author }}</ion-label>
  </ion-card-content>
</ion-card>

<stapps-simple-card
  *ngIf="item.firstPublished && !item.lastPublished"
  [title]="'hebisSearch.detail.firstPublished' | translate | sentencecase"
  [content]="item.firstPublished"
>
</stapps-simple-card>

<stapps-simple-card
  *ngIf="item.firstPublished && item.lastPublished"
  [title]="'hebisSearch.detail.firstPublished' | translate | sentencecase"
  [content]="[item.firstPublished, item.lastPublished] | join : ' - '"
>
</stapps-simple-card>

<ion-card *ngIf="item.publications">
  <ion-card-header>{{ 'publications' | propertyNameTranslate : item | sentencecase }}</ion-card-header>
  <ion-card-content>
    <p *ngFor="let publication of item.publications">
      {{ publication.locations | join : ', ' }} {{ publication.locations && publication.publisher ? ':' : ''
      }} {{ publication.publisher }}
    </p>
  </ion-card-content>
</ion-card>

<stapps-simple-card
  *ngIf="item.reference"
  [title]="'reference' | propertyNameTranslate : item | sentencecase"
  [content]="item.reference"
></stapps-simple-card>

<stapps-simple-card
  *ngIf="item.isPartOf"
  [title]="'isPartOf' | propertyNameTranslate : item | sentencecase"
  [content]="item.isPartOf.name"
></stapps-simple-card>
<ion-card *ngIf="item.categories">
  <ion-card-header>{{ 'categories' | propertyNameTranslate : item | sentencecase }}</ion-card-header>
  <ion-card-content>
    <ion-chip [color]="'primary'">
      <ion-icon [name]="item.type | dataIcon"></ion-icon>
      <ion-label>{{ 'categories' | thingTranslate : item }}</ion-label>
    </ion-chip>
  </ion-card-content>
</ion-card>
