<?php
require_once 'config/db.php';
require_once 'services/MessageService.php';

$msgService = new MessageService($conn);

$stmt = $conn->prepare("SELECT * FROM user_templates WHERE user_id = 4");
$stmt->execute();
$tplData = $stmt->get_result()->fetch_assoc();

$tplOptions = [
    'pos_x' => $tplData['pos_x'] ?? 50,
    'pos_y' => $tplData['pos_y'] ?? 90,
    'font_size' => $tplData['font_size'] ?? 20,
    'font_color' => $tplData['font_color'] ?? '#000000'
];

$outputPath = 'uploads/temp_pdfs/test_real_' . time() . '.pdf';

$res = $msgService->generateBirthdayPdf($tplData['image_path'], "Rohit Sharma", $outputPath, $tplOptions);

var_dump($res);
if(file_exists($outputPath)){
    echo "PDF Created: " . $outputPath . "\n";
} else {
    echo "PDF Failed to create\n";
}
