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

@if (item.sameAs) {
  <ion-card>
    <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>
}
@if (!item.sameAs) {
  <stapps-simple-card
    [title]="'name' | propertyNameTranslate: item | sentencecase"
    [content]="'name' | thingTranslate: item"
  >
  </stapps-simple-card>
}
@if (item.description) {
  <stapps-simple-card
    [title]="'hebisSearch.detail.description' | translate | sentencecase"
    [content]="item.description"
  ></stapps-simple-card>
}
@if (item.sourceOrganization) {
  <stapps-simple-card
    [title]="'sourceOrganization' | propertyNameTranslate: item | sentencecase"
    [content]="item.sourceOrganization"
  ></stapps-simple-card>
}
@if (item.authors && item.authors.length > 0) {
  <ion-card>
    <ion-card-header>{{ 'authors' | propertyNameTranslate: item | sentencecase }}</ion-card-header>
    <ion-card-content>
      @for (author of item.authors; track author) {
        <ion-label>{{ 'name' | thingTranslate: author }}</ion-label>
      }
    </ion-card-content>
  </ion-card>
}
@if (item.firstPublished && !item.lastPublished) {
  <stapps-simple-card
    [title]="'hebisSearch.detail.firstPublished' | translate | sentencecase"
    [content]="item.firstPublished + '-'"
  >
  </stapps-simple-card>
}
@if (item.firstPublished && item.lastPublished) {
  <stapps-simple-card
    [title]="'hebisSearch.detail.firstPublished' | translate | sentencecase"
    [content]="[item.firstPublished, item.lastPublished] | join: ' - '"
  >
  </stapps-simple-card>
}
@if (item.publications) {
  <ion-card>
    <ion-card-header>{{ 'publications' | propertyNameTranslate: item | sentencecase }}</ion-card-header>
    <ion-card-content>
      @for (publication of item.publications; track publication) {
        <p>
          {{ publication.locations | join: ', ' }}
          {{ publication.locations && publication.publisher ? ':' : '' }} {{ publication.publisher }}
        </p>
      }
    </ion-card-content>
  </ion-card>
}
@if (item.categories) {
  <ion-card>
    <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>
}
@if (item.ISSNs) {
  <stapps-simple-card
    [title]="'ISSNs' | propertyNameTranslate: item | sentencecase"
    [content]="item.ISSNs | join: ', '"
  >
  </stapps-simple-card>
}
