<template>
  <ModalDialog v-if="show" @backdrop-click="$emit('cancel')">
    <template #default>
      <div class="approve-dialog">
        <img v-if="imageUrl" :src="imageUrl" alt="Chore" class="chore-image" />
        <p class="child-label">{{ childName }}</p>
        <p class="message">completed <strong>{{ choreName }}</strong></p>
        <p class="message">Will be awarded <strong>{{ points }} points</strong></p>
        <div class="actions">
          <button class="btn btn-primary" @click="$emit('approve')">Approve</button>
          <button class="btn btn-secondary" @click="$emit('reject')">Reject</button>
        </div>
      </div>
    </template>
  </ModalDialog>
</template>

<script setup lang="ts">
import ModalDialog from '../shared/ModalDialog.vue'

defineProps<{
  show: boolean
  childName: string
  choreName: string
  points: number
  imageUrl?: string | null
}>()

defineEmits<{
  approve: []
  reject: []
  cancel: []
}>()
</script>

<style scoped>
.approve-dialog {
  text-align: center;
  padding: 0.5rem;
}
.chore-image {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--info-image-bg);
  margin-bottom: 0.75rem;
}
.child-label {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dialog-child-name);
  margin-bottom: 0.15rem;
}
.message {
  font-size: 1rem;
  color: var(--dialog-message);
  margin-bottom: 0.15rem;
}
.message:last-of-type {
  margin-bottom: 1.5rem;
}
.actions {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
}
.actions button {
  padding: 0.7rem 1.8rem;
  border-radius: 10px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  font-size: 1.05rem;
  transition: background 0.18s;
  min-width: 100px;
}
</style>
