import { ElNotification } from 'element-plus';
import Swal from 'sweetalert2';
import { LockScreenStatus, useClientStore } from '@/store/modules/client';
class ScriptEvent {
  ElNotification(options = {}) {
    ElNotification(options);
  }
  Swal(options = {}) {
    Swal.fire(options);
  }
  trigger(name, data) {
    console.debug('ws.trigger#script', name, data);
    this[name]?.(data);
  }
}

export const scriptEvent: ScriptEvent = new ScriptEvent();

class SystemEvent {
  /**
   * 登录成功事件
   */
  loginSuccess() {}
  /**
   * 锁定客户端
   */
  lockClient() {
    useClientStore().setLockScreen(LockScreenStatus.LOCK);
  }
  trigger(name, data) {
    console.debug('ws.trigger#system', name, data);
    this[name]?.(data);
  }
}
export const systemEvent: SystemEvent = new SystemEvent();
