<script setup>
import Modal from '@Holos/Modal.vue';
import GoogleIcon from '@Shared/GoogleIcon.vue';

const props = defineProps({
    show: Boolean,
    bundle: Object
});

const emit = defineEmits(['close', 'confirm']);

const handleConfirm = () => {
    emit('confirm', props.bundle.id);
};

const handleClose = () => {
    emit('close');
};
</script>

<template>
    <Modal :show="show" max-width="md" @close="handleClose">
        <div class="p-6">
            <!-- Header -->
            <div class="flex items-center justify-between mb-6">
                <div class="flex items-center gap-3">
                    <div class="flex items-center justify-center w-12 h-12 rounded-full bg-red-100 dark:bg-red-900/30">
                        <GoogleIcon name="delete_forever" class="text-2xl text-red-600 dark:text-red-400" />
                    </div>
                    <h3 class="text-lg font-bold text-gray-900 dark:text-gray-100">
                        Eliminar Paquete
                    </h3>
                </div>
                <button
                    @click="handleClose"
                    class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-300"
                >
                    <GoogleIcon name="close" class="text-xl" />
                </button>
            </div>

            <!-- Contenido -->
            <div class="space-y-4">
                <p class="text-gray-700 dark:text-gray-300">
                    ¿Estás seguro de que deseas eliminar este paquete?
                </p>

                <!-- Información del bundle -->
                <div v-if="bundle" class="bg-gray-50 dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4">
                    <p class="font-bold text-gray-900 dark:text-gray-100 mb-1">
                        {{ bundle.name }}
                    </p>
                    <p class="text-sm text-gray-600 dark:text-gray-400">
                        SKU: {{ bundle.sku }}
                    </p>
                    <p class="text-sm text-gray-600 dark:text-gray-400">
                        {{ bundle.items?.length || 0 }} componentes
                    </p>
                </div>

                <!-- Advertencia -->
                <div class="flex items-start gap-2 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg p-3">
                    <GoogleIcon name="info" class="text-red-600 dark:text-red-400 text-xl flex-shrink-0" />
                    <p class="text-sm text-red-800 dark:text-red-300">
                        Esta acción no afectará los productos individuales del inventario.
                    </p>
                </div>
            </div>

            <!-- Botones -->
            <div class="flex items-center justify-end gap-3 mt-6 pt-4 border-t border-gray-200 dark:border-gray-700">
                <button
                    @click="handleClose"
                    class="px-4 py-2 text-sm font-medium text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 border border-gray-300 dark:border-gray-600 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-700 transition-colors"
                >
                    Cancelar
                </button>
                <button
                    @click="handleConfirm"
                    class="flex items-center gap-2 px-4 py-2 bg-red-600 hover:bg-red-700 text-white text-sm font-semibold rounded-lg transition-colors"
                >
                    <GoogleIcon name="delete" class="text-xl" />
                    Eliminar Paquete
                </button>
            </div>
        </div>
    </Modal>
</template>
