<!--
~ 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/>.
-->
<ion-card>
  <ion-card-header>
    <ion-card-title>
      <h1>
        @if ($any(item).honorificPrefix) {
          {{ 'honorificPrefix' | thingTranslate: item }}
        }
        {{ 'name' | thingTranslate: item }}
        @if ($any(item).honorificSuffix) {
          {{ 'honorificSuffix' | thingTranslate: item }}
        }
      </h1>
    </ion-card-title>
  </ion-card-header>
  <ion-card-content>
    @if ($any(item).openingHours; as openingHours) {
      <div class="opening-hours">
        <stapps-opening-hours [openingHours]="openingHours"></stapps-opening-hours>
      </div>
    }
    <!-- TODO obviously this is bad style. Tbd where to put the differentiation. Job Postings always have a description, but it's going to be shown in `stapps-job-posting-detail-content` anyways, no need to repeat here. For this view, I would use other fields of the schema.org JobPosting like the `ThingWithCategory.category` -->
    @if (item.description && item.type !== 'job posting') {
      <div class="description">
        <div class="text-accordion" [style.-webkit-line-clamp]="descriptionLinesToDisplay" #accordionTextArea>
          {{ 'description' | thingTranslate: item }}
        </div>
      </div>
    }
    <!-- TODO see above -->
    @if (item.description && item.type !== 'job posting' && buttonShown) {
      <ion-button expand="full" fill="clear" (click)="toggleDescriptionAccordion()">
        <ion-icon [name]="buttonState" size="large"></ion-icon>
      </ion-button>
    }
  </ion-card-content>
</ion-card>
