import { ElNotification } from 'element-plus';

const DURATION = 1500;

const NotificationService = {
  success(message, title = '成功', options = {}) {
    return ElNotification({
      title,
      message,
      duration:DURATION,
      type: 'success',
      ...options,
    });
  },
  warning(message, title = '警告', options = {}) {
    return ElNotification({
      title,
      message,
      duration:DURATION,
      type: 'warning',
      ...options,
    });
  },
  info(message, title = '信息', options = {}) {
    return ElNotification({
      title,
      message,
      duration:DURATION,
      type: 'info',
      ...options,
    });
  },
  error(message, title = '错误', options = {}) {
    return ElNotification({
      title,
      message,
      duration:DURATION,
      type: 'error',
      ...options,
    });
  },
};

export default NotificationService;
