import { ElementRef } from '@angular/core';
import { QdNotification, QdNotificationType } from '../interfaces/notifications';
import { QdNotificationsService } from '../services/notifications-service.service';
import { QdSnackbarService } from '../services/snackbar.service';
import * as i0 from "@angular/core";
/**
 *  **QdNotification** displays a single notification item within a **QdNotifications** container.
 *
 * # Notifications Service
 *
 * The **Notifications Service** can be used to catch errors from the backend. In addition, this service provides several methods to display messages.
 *
 * ## Notification from Backend
 *
 * The **QdUiModule** provides an HTTP interceptor that displays request errors as snackbar notifications. To get the proper notification messages for the corresponding backend errors, please comply with these conventions.
 *
 * ### Example of a response object
 *
 * The backend service response has to contain an errorCode field. This error code will be mapped to get the translation for the notification message.
 *
 * ```json
 * {
 *   "errorCode": "TRANSPORT_COCKPIT_PERSISTENCE_ERROR",
 *   "errorMessage": "TRANSPORT_COCKPIT_PERSISTENCE_ERROR: Could not find Declaration wih id: b78e0734-ae1b-434e-b44d-b48797f5696d"
 * }
 * ```
 *
 * ### Define Error Codes in the QdUiModule
 *
 * The **QdUiModule** expects an enum with error codes as the second parameter. For these given error codes you can define specific notification messages.
 *
 * This is an example configuration of the **QdUiModule** in the **app.module.ts**.
 *
 * ```typescript
 * enum ErrorCodes {
 *   TRANSPORT_COCKPIT_PERSISTENCE_ERROR,
 *   TRANSPORT_COCKPIT_VALIDATION_ERROR
 * }
 * ```
 *
 * ```typescript
 * imports: [
 *   ...
 *   QdUiModule.forRoot(appEnvironment, ErrorCodes),
 *   ...
 * ]
 * ```
 *
 * ### Translations:
 *
 * You can define the specific backend error notification messages for the respective error codes under `"ERROR"` in the translation files.
 *
 * ```json
 * {
 *   ...
 *
 *   "ERROR": {
 *     "TRANSPORT_COCKPIT_PERSISTENCE_ERROR": "In der Datenbank ist ein Fehler aufgetreten",
 *     "TRANSPORT_COCKPIT_VALIDATION_ERROR": "Ungültige Eingabe"
 *   }
 * }
 * ```
 *
 * ### Default error messages
 *
 * A default error message is shown if no error code is given in the backend response or the error code is not defined in the `ErrorCodes` enum that you pass to the **QdUiModule**.
 *
 * To override the default error messages you have to add the corresponding HTTP error code in the `ErrorCodes` enum. Then you can define a custom default error message in the translation files.
 *
 * ```typescript
 * enum ErrorCodes {
 *   ...,
 *   HTTP_BAD_REQUEST,
 *   HTTP_UNAUTHORIZED,
 *   HTTP_FORBIDDEN,
 *   HTTP_NOT_FOUND,
 *   HTTP_SERVER_ERROR,
 *   HTTP_UNKNOWN_ERROR
 * }
 * ```
 *
 * ```json
 * {
 *   ...
 *
 *   "ERROR": {
 *     "HTTP_BAD_REQUEST": "This is a custom error message for a response with the HTTP status code 400.",
 *     "HTTP_UNAUTHORIZED": "This is a custom error message for a response with the HTTP status code 401.",
 *     "HTTP_FORBIDDEN": "This is a custom error message for a response with the HTTP status code 403.",
 *     "HTTP_NOT_FOUND": "This is a custom error message for a response with the HTTP status code 404.",
 *     "HTTP_SERVER_ERROR": "This is a custom error message for a response with some server error (HTTP status code 5xx).",
 *     "HTTP_UNKNOWN_ERROR": "This is a custom error message for all other errors."
 *   }
 * }
 * ```
 *
 * ### Whitelisting HTTP status codes
 *
 * In some cases, you might want to prevent certain HTTP status codes from triggering error notifications. For example, a 304 Not Modified response is not actually an error and should not display an error notification. The **QdUiModule** allows you to whitelist specific HTTP status codes.
 *
 * To whitelist HTTP status codes, pass an array of status codes as the third parameter to the **QdUiModule.forRoot** method:
 *
 * ```typescript
 * import { HttpStatusCode } from '@angular/common/http';
 *
 * imports: [
 *   ...
 *   QdUiModule.forRoot(
 *     appEnvironment,
 *     ErrorCodes,
 *     [HttpStatusCode.NotModified, HttpStatusCode.NoContent] // Whitelist 304 Not Modified and 204 No Content
 *   ),
 *   ...
 * ]
 * ```
 *
 * When a response with a whitelisted status code is received, no error notification will be displayed, even if it would normally be treated as an error by the HTTP client.
 *
 * ### Blacklisting HTTP status codes
 *
 * For critical errors, notifications are always shown, even if the status code is whitelisted. The **QdUiModule** implements a fixed blacklist that takes precedence over the whitelist.
 *
 * The following status codes are permanently blacklisted:
 * - 401 Unauthorized
 * - 402 Payment Required
 * - 403 Forbidden
 * - All 5xx server error codes (500-511)
 *
 * These critical errors will always show notifications, even if they are included in the whitelist.
 *
 * **Important**: The blacklist has higher precedence than the whitelist. If a status code appears in both the whitelist and the blacklist, it will be treated as blacklisted, and an error notification will be shown.
 *
 * ### Component:
 *
 * ```typescript
 * class MyNotificationComponent {
 *   data;
 *
 *   constructor(private http: HttpClient) {}
 *
 *   private setData(data) {
 *     this.data = data;
 *   }
 *
 *   public callApiEndPoint() {
 *     // This way you can display the content in the frontend.
 *     return this.http.get('route/to/endpoint').subscribe({
 *       next: res => this.setData(res),
 *       error: err => this.setData(err)
 *     });
 *   }
 * }
 * ```
 *
 * The errors are rendered into a container, which by default has the attribute `context="qdPanel"`.
 *
 * ```html
 * <!-- Landing pad for notifications -->
 * <qd-notifications></qd-notifications>
 * ```
 *
 * ## Notifications via service
 *
 * ### Interfaces:
 *
 * ```typescript
 * interface QdNotification {
 *   uuid?: string;
 *   context?: string;
 *   type: QdNotificationType;
 *   i18n: QdNotificationTranslation;
 *   title?: QdNotificationTitle;
 *   date?: Date;
 *   lifeTime?: number;
 *   disableClose?: boolean;
 *   onClose?: () => void;
 *   showAsSnackbar?: boolean;
 *   snackbarOptions?: QdSnackbarNotificationOptions;
 *   showAsOsNotification?: boolean;
 *   osNotificationOptions?: QdOsNotificationOptions;
 * }
 *
 * type QdNotificationType = 'info' | 'warning' | 'critical' | 'success';
 *
 * type QdNotificationTranslation = string;
 * type QdNotificationTitle = { i18n: string };
 *
 * type QdNotifications = QdNotification[];
 *
 * interface QdSnackbarNotificationOptions {
 *   lifeTime?: number;
 *   disableClose?: boolean;
 *   onClose?: () => void;
 * }
 *
 * interface QdOsNotificationOptions {
 *   silent?: boolean;
 *   lifeTime?: number;
 *   onClose?: (event) => void;
 *   onClick?: (event) => void;
 * }
 * ```
 *
 * The Notifications Service provides some methods to display them in the frontend.
 *
 * ### Component
 *
 * ```typescript
 * class MyNotificationComponent {
 *   constructor(private notificationsService: QdNotificationsService) {}
 *
 *   public add(context: string, notification: QdNotification): void {
 *     this.notificationsService.add(context, notification);
 *   }
 * }
 * ```
 *
 * ### Type QdNotification (Second param of the add method)
 *
 * ```typescript
 * interface QdNotification {
 *   ...
 *
 *   type: QdNotificationType;
 *   i18n: string;
 *   lifeTime?: number;
 * }
 *
 * type QdNotifications = QdNotification[];
 * ```
 *
 * ### Type QdNotificationType
 *
 * ```typescript
 * type QdNotificationType = 'info' | 'warning' | 'critical' | 'success';
 * ```
 *
 * ### Template
 *
 * ```html
 * <button (click)="add('qdPanel', { type: 'critical', i18n: 'i18n.error.critical' })">Add Notification</button>
 * ```
 *
 * ### Template for displaying notifications - for instance in the Info Panel
 *
 * ```html
 * <qd-notifications></qd-notifications>
 * ```
 *
 * ## Notifications as a snackbar
 *
 * You can also display the notifications as a snack bar. They are then on top of the layout system. What you need to do is to place the directive `qdSnackbarListener` there. Also, just add the `showAsSnackbar` parameter to the method call.
 *
 * ### Example
 *
 * ```html
 * <qd-section qdSnackbarListener> My Container Content </qd-section>
 *
 * <button (click)="addNotification('qdPanel', { type: 'critical', i18n: 'i18n.error.critical', showAsSnackbar: true })">
 *   Add Notification
 * </button>
 * ```
 *
 * All notifications are now displayed by the directive contained in the `qd-section`. Also, all notifications from the backend are displayed there.
 *
 * **Recommendation of the Quadrel Team**: Place the `qdSnackbarListener` directly on top of the layout system - so for example in the **AppComponent**.
 *
 * ### Options
 *
 * You can also pass a configuration object in the `snackbarOptions` parameter to customize the snackbar notification or to set an `onClose` handler.
 * When you close the main notification, the snackbar notification will be closed automatically. The snackbar notification can be closed for itself alone.
 *
 * In the `snackbarOptions` configuration object you can override the properties `disableClose` and `lifeTime`. When the main notification is closed,
 * the snackbar notification will also be closed. So the life time of the snackbar notification only can be shorter.
 *
 * ## OS Notifications
 *
 * To bring a notification to the foreground, even if the application window is not in focus, you can also push the notification as an OS Notification.
 * Then the notification will also be pushed through the Notification browser API and will be displayed on your operating system (e.g. Windows/Linux).
 * In the future, the OS Notifications will also be pushed as smartphone system notifications. Currently, only desktop notifications are supported.
 *
 * ### Example
 *
 * ```html
 * <button (click)="addNotification('qdPanel', { type: 'critical', i18n: 'i18n.error.critical', showAsOsNotification: true })">
 *   Add Notification
 * </button>
 * ```
 *
 * ### Options
 *
 * You can also pass a configuration object in the `osNotificationOptions` parameter to customize the OS notification or to set `onClick` and `onClose` handlers.
 * When you close the main notification, the OS notification will be closed automatically. The OS notification can be closed for itself alone.
 *
 * In the `osNotificationOptions` configuration object you can override the properties `disableClose` and `lifeTime`. When the main notification is closed,
 * the OS notification will also be closed. So the life time of the OS notification only can be shorter.
 *
 * ### Deep links
 *
 * To open a deep link when the OS notification is clicked, use the following code for the click handler:
 *
 * ```typescript
 * event.preventDefault();
 * window.open('https://your/deep/link');
 * ```
 *
 * ## Notifications via service (multiple instances)
 *
 * ### Object of multiple notifications
 *
 * ```typescript
 * const BULK: QdNotifications = [
 *   {
 *     type: 'critical',
 *     i18n: 'i18n.error.1'
 *   },
 *   {
 *     type: 'critical',
 *     i18n: 'i18n.error.2'
 *   }
 * ];
 * ```
 *
 * ### Component
 *
 * ```typescript
 * class MyNotificationComponent {
 *   bulk: QdNotifications = BULK;
 *
 *   constructor(private notificationsService: QdNotificationsService, public modalService: QdModalService) {}
 *
 *   openNotificationModal(mrn) {
 *     // MRN represents a unique context
 *     this.modalService.open(MyNotificationModalComponent, { data: { mrn } });
 *
 *     // Adds the notifications when opening
 *     this.notificationsService.addBulk(mrn, this.bulk);
 *   }
 * }
 * ```
 *
 * ### Template
 *
 * ```html
 * <mat-table [dataSource]="dataSource">
 *   <ng-container matColumnDef="mrn">
 *     <mat-header-cell *matHeaderCellDef class="center">Mrn.</mat-header-cell>
 *     <mat-cell *matCellDef="let element" class="center">
 *       <button mat-button color="primary" (click)="openNotificationModal(element.mrn)">
 *         <!-- MRN represents a unique context -->
 *         {{ element.mrn }}
 *       </button>
 *     </mat-cell>
 *   </ng-container>
 * </mat-table>
 * ```
 *
 * ## Notification Events
 *
 * You can define an `onClose` callback for each notification type. When the main notification is closed, then
 * the corresponding snackbar notification and OS notification will also be closed and all events will be fired.
 *
 * ```typescript
 * class MyNotificationComponent {
 *   constructor(private notificationsService: QdNotificationsService) {}
 *
 *   showNotification(): void {
 *     this.notificationsService.add(
 *       'qdPanel',
 *       {
 *         type: 'critical',
 *         i18n: 'i18n.error.critical',
 *         onClose: () => console.log('Notification closed.'),
 *         showAsSnackbar: true,
 *         snackbarOptions: {
 *           onClose: () => console.log('Snackbar Notification closed.')
 *         }
 *         showAsOsNotification: true,
 *         osNotificationOptions: {
 *           onClose: () => console.log('OS Notification closed.')
 *         }
 *       }
 *     );
 *   }
 * }
 * ```
 *
 * Especially for the OS notification an `onClick` handler can be defined. With the onClick handler it's also possible
 * to define a deep link that will be opened on click with the following code:
 *
 * ```typescript
 * this.notificationsService.add(
 *   'qdPanel',
 *   {
 *     type: 'critical',
 *     i18n: 'i18n.error.critical',
 *     showAsOsNotification: true,
 *     osNotificationOptions: {
 *       onClick: (event) => {
 *         event.preventDefault();
 *         window.open('https://your/deep/link');
 *       }
 *     }
 *   }
 * );
 * ```
 *
 * ## Inline Notifications
 *
 * Notifications can also be inserted directly into the template.
 *
 * ```html
 * <qd-notification [type]="type" [notification]="notification">
 *   <qd-notification-content> test notification content </qd-notification-content>
 * </qd-notification>
 * ```
 *
 * ```typescript
 * // The type can be defined with the type input
 * type = 'critical';
 *
 * // ... or in the notification config
 * notification: QdNotification = {
 *   type: 'critical'
 * }
 * ```
 *
 * The content can also be defined in the config. Then you don't have to put a `qd-notification-content`
 * element into the `qd-notification`.
 *
 * ```html
 * <qd-notification [notification]="notification"></qd-notification>
 * ```
 *
 * ```typescript
 * notification: QdNotification = {
 *   type: 'critical',
 *   i18n: 'i18n.error.critical'
 * }
 * ```
 *
 * ## Multiline Notifications
 *
 * To create a multiline notification you simply can insert `\n` in the i18n translation text. Line breaks (`\n`) are
 * not considered if you use the `<qd-notification-content>` variant. Line breaks only work if you define the
 * i18n key in the notification config.
 *
 * ### Example
 *
 * ```typescript
 * notification: QdNotification = {
 *   type: 'warning',
 *   i18n: 'i18n.ncts.declaration.detailInventoryResult.notification.transitDeadlineExpired'
 * }
 * ```
 *
 * ```json
 * {
 *   ...
 *
 *   "i18n.ncts.declaration.detailInventoryResult.notification.transitDeadlineExpired": "The inventory result must be checked and the control result recorded. \nAttention: The transit period has expired upon arrival at the Authorized Place",
 * }
 * ```
 *
 * ### Notifications Service
 *
 * | Method                       | Params                                                 | description                                      | default |
 * | ---------------------------- | ------------------------------------------------------ | ------------------------------------------------ | ------- |
 * | getNotificationsForContext() | context: string                                        | Returns notification stream for context.         | -       |
 * | add()                        | context: string, notification: QdNotification          | Adds a single notification.                      | -       |
 * | addBulk()                    | context: string, notifications: QdNotifications        | Adds multiple notifications.                     | -       |
 * | remove()                     | context: string, id: string                            | Removes specific notification.                   | -       |
 * | removeAll()                  | context: string                                        | Removes all notifications in context.            | -       |
 * | reset()                      | -                                                      | Clear all notifications.                         | -       |
 */
export declare class QdNotificationComponent {
    private readonly notificationService;
    private readonly snackbarService;
    private element;
    /**
     * Defines the type of this notification.
     */
    type: QdNotificationType;
    /**
     * Configuration of a notification.
     */
    notification: QdNotification;
    get typeClassName(): string;
    get closeable(): boolean;
    constructor(notificationService: QdNotificationsService, snackbarService: QdSnackbarService, element: ElementRef);
    getType(): QdNotificationType;
    getIcon(): string;
    remove(): void;
    handleLinkClick(): void;
    private isNotificationInSnackbar;
    static ɵfac: i0.ɵɵFactoryDeclaration<QdNotificationComponent, never>;
    static ɵcmp: i0.ɵɵComponentDeclaration<QdNotificationComponent, "qd-notification", never, { "type": { "alias": "type"; "required": false; }; "notification": { "alias": "notification"; "required": false; }; }, {}, never, ["qd-notification-content"], false, never>;
}
//# sourceMappingURL=notification.component.d.ts.map