<?php
require_once __DIR__ . '/../config/database.php';

class GiftController {

    private $conn;

    public function __construct() {
        $this->conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
        if ($this->conn->connect_error) {
            die("Error de conexión: " . $this->conn->connect_error);
        }
    }

    public function getGifts() {
        $result = $this->conn->query("SELECT * FROM gifts");
        $gifts = [];
        while ($row = $result->fetch_assoc()) {
            $gifts[] = $row;
        }
        return $gifts;
    }

    public function redeemGift($customerId, $giftId) {
        // Lógica para canjear regalo
    }
}
?>