<template>
    <div v-if="modelValue" class="dialog-overlay">
      <div class="dialog">
        <h2>{{ title }}</h2>
        <p>{{ message }}</p>
        <button @click="closeDialog">OK</button>
      </div>
    </div>
  </template>
  
  <script>
  export default {
    name: 'DialogComponent',
    props: {
      title: {
        type: String,
        required: true
      },
      message: {
        type: String,
        required: true
      },
      modelValue: {
        type: Boolean,
        default: false
      }
    },
    methods: {
      closeDialog() {
        this.$emit('update:modelValue', false);
        this.$emit('close');
      }
    }
  };
  </script>
  
  <style scoped>
  .dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
  }
  
  .dialog {
    background: white;
    padding: 20px;
    border-radius: 5px;
    max-width: 400px;
    width: 100%;
    text-align: center;
  }
  
  button {
    margin-top: 20px;
  }
  </style>
  