<!--

    Copyright © 2016-2026 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<section class="notification flex flex-row items-start justify-between"
         [style]="{borderColor: notificationColor(), backgroundColor: notificationBackgroundColor()}">
  @if (showIcon) {
    <div>
      <tb-icon class="icon" [style.color]="notification.additionalConfig.icon.color">
        {{ notification.additionalConfig.icon.icon }}
      </tb-icon>
    </div>
  } @else {
    @if (notificationTypeIcons.get(notification.type)) {
      <tb-icon class="icon" [style]="notificationIconColor()">
        {{ notificationTypeIcons.get(notification.type) }}
      </tb-icon>
    }
  }
  <div class="content flex-1">
    <div class="title" [innerHTML]="title"></div>
    <div class="message" [innerHTML]="message"></div>
    @if (showButton) {
      <button mat-stroked-button class="button" color="primary"
              (click)="navigate($event)">
        {{ buttonLabel }}
      </button>
    }
  </div>
  <div class="description flex flex-col items-end justify-start">
    <span class="time">{{ notification.createdTime ?? currentDate | dateAgo }}</span>
    @if (!hideMarkAsReadButton) {
      <button mat-icon-button (click)="markRead($event)"
              matTooltip="{{ 'notification.mark-as-read' | translate }}" matTooltipPosition="above">
        <mat-icon>check_circle_outline</mat-icon>
      </button>
    }
    @if (notification.type === notificationType.ALARM && !notification.info.cleared) {
      <div class="alarm-severity"
           [style.background-color]="alarmColorSeverityBackground()">
        <span [style]="notificationIconColor()" class="severity">
          {{alarmSeverityTranslations.get(notification.info.alarmSeverity) | translate}}
        </span>
      </div>
    }
  </div>
</section>
