<template>
  <ModalDialog
    v-if="routine"
    title="Confirm Routine"
    :subtitle="routine.name"
    :imageUrl="routine.image_url"
    @backdrop-click="$emit('cancel')"
  >
    <div class="modal-message">
      Add these points to
      <span class="child-name">{{ childName }}</span>
    </div>
    <div class="modal-actions">
      <button class="btn btn-primary" @click="$emit('confirm')">Yes</button>
      <button class="btn btn-secondary" @click="$emit('cancel')">Cancel</button>
    </div>
  </ModalDialog>
</template>

<script setup lang="ts">
import ModalDialog from '../shared/ModalDialog.vue'
import type { ChildRoutine } from '@/common/models'

defineProps<{
  routine: ChildRoutine | null
  childName?: string
}>()

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

<style scoped>
.modal-message {
  margin-bottom: 1.2rem;
  font-size: 1rem;
  color: var(--modal-message-color, #333);
}

.child-name {
  font-weight: 600;
  color: var(--text-primary, #333);
}
</style>
