<!-- SimpleSnackbar.vue -->
<template>
  <v-snackbar
    v-model="localVisible"
    :multi-line="multiLine"
    :color="color"
    :timeout="timeout"
    :location="location"
    variant="elevated"
    z-index="999999999999999999999999999999"
  >
    {{ message }}
    <template v-slot:actions>
      <v-btn text @click="closeSnackbar">Tutup</v-btn>
    </template>
  </v-snackbar>
</template>

<script>
  export default {
    props: {
      multiLine: {
        type: Boolean,
        default: false,
      },
      modelValue: {
        type: Boolean,
        default: false,
      },
      message: {
        type: String,
        default: "",
      },
      color: {
        type: String,
        default: "success",
      },
      location: {
        type: String,
        default: "top",
      },
      timeout: {
        type: Number,
        default: 3000,
      },
    },
    computed: {
      localVisible: {
        get() {
          return this.modelValue;
        },
        set(value) {
          this.$emit("update:modelValue", value);
        },
      },
    },
    methods: {
      closeSnackbar() {
        this.localVisible = false;
      },
    },
  };
</script>
