<template>
  <v-snackbar
    v-model="show" :color="color" location="bottom right" timeout="4000"
    multi-line elevation="4"
  >
    {{ message }}
    <template #actions>
      <v-btn variant="text" @click="show = false">Dismiss</v-btn>
    </template>
  </v-snackbar>
</template>

<script setup>
import { ref } from 'vue'
const show = ref(false)
const message = ref('')
const color = ref('error')

function open({ text, type = 'error' }) {
  message.value = text
  color.value = type === 'error' ? 'error' : type === 'success' ? 'success' : 'info'
  show.value = true
}

defineExpose({ open })
</script>
