<template>
  <q-card flat bordered class="q-pa-md">
    <div style="display: flex; justify-content: space-between; align-items: flex-start; gap: 8px">
      <div style="flex: 1">
        <div class="text-body2">
          <span class="text-weight-medium">Comentário:</span> {{ reply }}
        </div>
        <div class="text-caption text-grey-6 q-mt-xs">
          {{ createdAt }} &mdash; {{ userName }}
        </div>
      </div>
      <div style="display: flex; gap: 4px; flex-shrink: 0">
        <q-btn
          v-if="canEdit"
          flat
          dense
          round
          icon="mdi-pencil-outline"
          size="sm"
          color="primary"
          @click="$emit('edit')"
        />
        <q-btn
          v-if="canDelete"
          flat
          dense
          round
          icon="mdi-trash-can-outline"
          size="sm"
          color="negative"
          @click="$emit('delete')"
        />
      </div>
    </div>
  </q-card>
</template>

<script setup>
import { computed } from "vue";
import { permissionStore } from "src/stores/permission";

const permissions = permissionStore();
const canEdit = computed(() => permissions.getAccess("franchisee_activities", "edit"));
const canDelete = computed(() => permissions.getAccess("franchisee_activities", "delete"));
defineEmits(["edit", "delete"]);

defineProps({
  reply: {
    type: String,
    required: true,
  },
  createdAt: {
    type: String,
    required: true,
  },
  userName: {
    type: String,
    required: true,
  },
});
</script>
