<template>
  <div class="card-content">
    <div class="content is-small">
      <h3>Steuerung</h3>
      <ul>
        <li>Linksklick: Türchen bearbeiten</li>
        <li>Tastatur: Tag eingeben</li>
        <li>[Enter]: Tag speichern</li>
        <li>[Esc]: Eingabe Abbrechen</li>
        <li>[Entf]: Tag entfernen</li>
      </ul>
    </div>
    <figure class="image is-unselectable">
      <img :src="unwrap_loading(store.background_image).data_url" />
      <ThouCanvas>
        <PreviewDoor
          v-for="(_, index) in model"
          :key="`door-${index}`"
          v-model="model[index]"
        />
      </ThouCanvas>
    </figure>
  </div>
</template>

<script setup lang="ts">
import { type VueLike, unwrap_loading } from "@/lib/helpers";
import { Door } from "@/lib/rects/door";
import { advent22Store } from "@/lib/store";

import ThouCanvas from "../calendar/ThouCanvas.vue";
import PreviewDoor from "./PreviewDoor.vue";

const model = defineModel<VueLike<Door>[]>({ required: true });
const store = advent22Store();
</script>
