import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';
import {
  TranslationEventJson,
  Info,
  MassTranslationEventJson
} from '@ucap-webmessenger/protocol-event';

@Component({
  selector: 'ucap-chat-message-box-mass-translation',
  templateUrl: './mass-translation.component.html',
  styleUrls: ['./mass-translation.component.scss']
})
export class MassTranslationComponent implements OnInit {
  @Input()
  message: Info<MassTranslationEventJson>;

  @Input()
  translationSimpleview: boolean;

  @Input()
  isMe: boolean;

  @Output()
  massTranslationDetail = new EventEmitter<{
    message: Info<MassTranslationEventJson>;
    contentsType: string;
  }>();

  @Output()
  contextMenu = new EventEmitter<{
    event: MouseEvent;
    type: string;
  }>();

  constructor() {}

  ngOnInit() {}

  onClickMassDetail(contentsType: string) {
    this.massTranslationDetail.emit({
      message: this.message,
      contentsType
    });
  }

  onContextMenuMessage(event: MouseEvent, type: string) {
    this.contextMenu.emit({ event, type });
  }
}
