import {copyToClipboard} from "./utils/copy-to-clipboard";

var Wick = window.Wick || {};
Wick.CopyProjectId = {
  NOTIFICATION_TEXT: 'Project ID successfully copied to clipboard',
  el: {
    copyBtn: '.copy-project__btn',
  },
  copyId() {
    const projectId = $(Wick.CopyProjectId.el.copyBtn).attr('data-project-id');
    copyToClipboard(projectId, this);

    Wick.Notification.show({
      text: Wick.CopyProjectId.NOTIFICATION_TEXT,
      container: '.globalMessages .col-12',
      type: 'success',
      closeBtn: true,
      noScrolling: true,
    });
  },
  init() {
    $(this.el.copyBtn).on('click', this.copyId)
  },
};

$(document).ready(function () {
  if (!Wick.CopyProjectId.el.copyBtn.length) {
    return;
  }

  Wick.CopyProjectId.init();
});
