export default {
  created() {
    const { $eventBus } = useNuxtApp();
    
    $eventBus.on("replay-comment", (comment, editFrom, replayFrom) => {
      this.replyComments(comment, editFrom, replayFrom);
    });
    // detecting change checked value from item component event.
    $eventBus.on("open-replays", (comment, index) => {
      this.openReplays(comment, index);
    });
    // detecting change checked value from item component event.
    $eventBus.on("edit-item", (comment, editFrom, replayFrom) => {
      this.editComment(comment, editFrom, replayFrom);
    });
    // detecting change checked value from item component event.
    $eventBus.on("delete-item", (comment, index, editFrom, replayFrom) => {
      this.deleteItem(comment, index, editFrom, replayFrom);
    });
    // detecting change checked value from item component event.
    $eventBus.on("update-selected-comments-id", ($event) => {
      this.selectedCommentsId = $event;
    });
    // detecting change checked value from item component event.
    $eventBus.on("select-many", () => {
      this.showSelectionActionBar = true;
    });

    // detecting change checked value from item component event.
    $eventBus.on("save-label", (data) => {
      this.saveLabel(data.selectedLabel, data.comment);
    });
    // detecting change checked value from item component event.
    $eventBus.on("get-section", ($event, comment) => {
      this.getSectionDetails($event, comment);
    });
    // detecting change checked value from item component event.
    $eventBus.on("make-message-link", (comment) => {
      this.makeLink(comment);
    });
    // detecting change checked value from item component event.
    $eventBus.on("forward-to", (comment) => {
      this.openForwardModal(comment);
    });
    // fired from group.vue ->addItem()
    $eventBus.on("show-auth-modal", () => {
      this.openAuthModal();
    });
    // // fired from chat MobileFooter.vue.
    $eventBus.on("open-message-actions-list", (value) => {
      this.showMobileActions = !this.showMobileActions;
    });
  },
};