import { ElMessage, ElMessageBox ,ElNotification} from 'element-plus'

export function success(message) {
  ElMessage({
    type:'success',
    message: message
  })
}

export function error(message) {
  ElMessage({
    type: 'error',
    message: message
  })
}

export function openElWarnMessage(message) {
  ElMessage({
    type: 'warning',
    message: message
  })
}

export function info(message) {
  ElMessage({
    type: 'info',
    message: message
  })
}

//弹窗，确认框
export function confirm(message, title = '提示', type = 'warning', callback) {
  ElMessageBox.confirm(message, title, {
    type: type,
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    callback: callback
  })
}

export function openElMessageBox(text, title) {
    ElMessageBox.alert(text, title, {
        confirmButtonText: 'OK',
        callback: () => {}
    })
}

export function openElMessage(text) {
    ElMessage(text)
}

//右上角弹窗(信息型)
export function openInfoElNotification(message) {
    ElNotification({
        title: 'Info',
        message: message,
        type: 'info',
    })
}

//右上角弹窗(错误型)
export function openErrorElNotification(message) {
    ElNotification({
        title: 'Error',
        message: message,
        type: 'error',
    })
}