/*
 * Copyright (C) 2019 Robert Bosch GmbH Copyright (C) 2019 Robert Bosch Manufacturing Solutions GmbH, Germany. All rights reserved.
 */

import { Component, EventEmitter, Input, Output } from '@angular/core';
import { CalloutType } from './callout.model';

@Component({
  selector: 'bci-callout',
  templateUrl: './callout.component.html',
  styleUrls: ['./callout.component.scss'],
})
export class CalloutComponent {
  /** The type of the callout */
  @Input() type: CalloutType;

  /** The content to be displayed */
  @Input() content: string;

  /**
   * @deprecated Property is deprecated and will be removed with the next major release. Use bci-banner component instead. 
   * Flag indicates if callout is closable */
  @Input() isClosable = false;

  /** Flag indicates if icon is visible */
  @Input() isIconVisible = true;

  /** 
   * @deprecated Event is deprecated and will be removed with the next major release. Use bci-banner component instead.
   * Event emits when callout is closed */
  @Output() closeClicked = new EventEmitter();

  onClose(): void {
    this.closeClicked.emit();
  }

  getCalloutIcon(): string {
    switch (this.type) {
      case 'success':
        return 'Bosch-Ic-notification-success-outline';
      case 'info':
        return 'Bosch-Ic-notification-info';
      case 'warn':
        return 'Bosch-Ic-notification-outline';
      case 'danger':
        return 'Bosch-Ic-notification-error-outline';
      default:
        return '';
    }
  }
}
