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

import { Component, EventEmitter, Inject, InjectionToken, Output } from '@angular/core';
import { CommandbarAddMenuItem } from './commandbar-addmenu.model';

export const COMMANDBAR_ADDMENU_DATA = new InjectionToken<CommandbarAddMenuItem>('COMMANDBAR_ADDMENU_DATA');

@Component({
  selector: 'bci-commandbar-addmenu',
  templateUrl: './commandbar-addmenu.component.html',
  styleUrls: ['./commandbar-addmenu.component.scss'],
})
export class CommandbarAddMenuComponent {
  @Output() closeOptionsMenu: EventEmitter<string> = new EventEmitter<string>();

  constructor(@Inject(COMMANDBAR_ADDMENU_DATA) public data: CommandbarAddMenuItem[]) {}

  actionClicked(item: CommandbarAddMenuItem): void {
    this.closeOptionsMenu.emit(item.type);
  }
}
