<template>
  <Modal :isModalOpen="true" @modal:close="() => zoneEditorStore.toggleSettingsModal()">
    <template #modalHeader>
      <h3 class="modal-title">Zone settings</h3>
    </template>

    <template #modalBody>
      <form method="post" @submit.prevent="" class="modal-form">
        <div class="form-fields">
          <div>
            <label for="name">Name</label>
            <input v-model="name" name="name" id="name" />
          </div>
          <div>
            <label for="name">Width</label>
            <input v-model="width" name="name" id="name" />
          </div>
          <div>
            <label for="name">Height</label>
            <input v-model="height" name="name" id="name" />
          </div>
          <div>
            <label for="name">PVP enabled</label>
            <input name="name" id="name" />
          </div>
        </div>
      </form>
    </template>
  </Modal>
</template>

<script setup>
import { ref, watch } from 'vue'
import Modal from '@/components/utilities/Modal.vue'
import { useZoneEditorStore } from '@/stores/zoneEditor'

const zoneEditorStore = useZoneEditorStore()

const name = ref(zoneEditorStore.name)
const width = ref(zoneEditorStore.width)
const height = ref(zoneEditorStore.height)

watch(name, (value) => {
  zoneEditorStore.setName(value)
})

watch(width, (value) => {
  zoneEditorStore.setWidth(value)
})

watch(height, (value) => {
  zoneEditorStore.setHeight(value)
})
</script>