<!--
~ Copyright (C) 2023 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.categories.includes('news')) {
  <div>
    <stapps-simple-card
      [title]="'messageBody' | propertyNameTranslate: item | titlecase"
      [content]="'messageBody' | thingTranslate: item"
    ></stapps-simple-card>
    <stapps-simple-card
      [title]="'audiences' | propertyNameTranslate: item | titlecase"
      [content]="'audiences' | thingTranslate: item"
    ></stapps-simple-card>
    @if (item.datePublished) {
      <stapps-simple-card
        [title]="'datePublished' | propertyNameTranslate: item | titlecase"
        [content]="item.datePublished | amDateFormat: 'll'"
      ></stapps-simple-card>
    }
    @if (item.authors) {
      <stapps-simple-card
        [title]="'authors' | propertyNameTranslate: item | titlecase"
        [content]="item.authors"
      ></stapps-simple-card>
    }
    @if (item.publishers) {
      <stapps-simple-card
        [title]="'publishers' | propertyNameTranslate: item | titlecase"
        [content]="item.publishers"
      ></stapps-simple-card>
    }
  </div>
} @else {
  @if (item.image) {
    <ion-thumbnail style="background-image: url('{{ item.image }}')">
      <ion-img
        src="{{ item.image }}"
        (ionError)="$any($event.target).nextSibling.style.display = 'none'"
        alt="{{ item.name }}"
      ></ion-img>
    </ion-thumbnail>
  }
  @if (item.datePublished) {
    <stapps-simple-card
      class="date-published"
      content="{{ item.datePublished | amCalendar | sentencecase }}"
    ></stapps-simple-card>
  }
  <stapps-simple-card content="{{ item.messageBody }}"></stapps-simple-card>
  @if (item.sameAs) {
    <ion-card>
      <ion-card-header> {{ 'sameAs' | propertyNameTranslate: item | titlecase }} </ion-card-header>
      <ion-card-content>
        <stapps-external-link [link]="item.sameAs" [text]="item.name"></stapps-external-link>
      </ion-card-content>
    </ion-card>
  }
}
