<template>
  <div class="flex flex-col h-fit w-full border border-primary rounded-md">
    <div class="bg-primary p-2 text-white flex flex-row justify-between items-center">
      <p>{{ communication.type.type }} {{ communication.preferred ? "(bevorzugt)" : "" }}</p>
      <EnvelopeIcon class="h-5 w-5 p-1 box-content" v-if="communication.isNewsletterMain" />
    </div>
    <div class="p-2">
      <p v-for="field in communication.type.fields" :key="field">{{ field }}: {{ communication[field] || "--" }}</p>
    </div>
  </div>
</template>

<script setup lang="ts">
import { defineComponent, type PropType } from "vue";
import { mapState, mapActions } from "pinia";
import type { CommunicationViewModel } from "@/viewmodels/admin/communication.models";
import { EnvelopeIcon } from "@heroicons/vue/24/outline";
</script>

<script lang="ts">
export default defineComponent({
  props: {
    communication: {
      type: Object as PropType<CommunicationViewModel>,
      default: {},
    },
  },
});
</script>
