<?php
require_once __DIR__ . '/functions.php';

function getRegisterNotificationEmail($lead) {
    $subject = 'New Stand Enquiry — ' . e($lead['company_name']);
    $body = <<<HTML
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <style>
        body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
        .container { max-width: 600px; margin: 0 auto; padding: 20px; }
        h2 { color: #2e7d32; border-bottom: 2px solid #2e7d32; padding-bottom: 10px; }
        .field { margin-bottom: 12px; }
        .label { font-weight: bold; color: #555; }
        .value { color: #333; }
        .footer { margin-top: 30px; padding-top: 15px; border-top: 1px solid #ddd; font-size: 12px; color: #999; }
    </style>
</head>
<body>
    <div class="container">
        <h2>New Stand Enquiry Received</h2>
        <p>A new stand booking enquiry has been submitted on the Ethiopia Food Expo website.</p>
        <div class="field"><span class="label">Company:</span> <span class="value">" . e($lead['company_name']) . "</span></div>
        <div class="field"><span class="label">Contact:</span> <span class="value">" . e($lead['first_name']) . " " . e($lead['last_name']) . "</span></div>
        <div class="field"><span class="label">Email:</span> <span class="value"><a href=\"mailto:" . e($lead['email']) . "\">" . e($lead['email']) . "</a></span></div>
        <div class="field"><span class="label">Phone:</span> <span class="value">" . e($lead['phone']) . "</span></div>
        <div class="field"><span class="label">Country:</span> <span class="value">" . e($lead['country']) . "</span></div>
        <div class="field"><span class="label">Stand Type:</span> <span class="value">" . e($lead['stand_type']) . "</span></div>
        <div class="field"><span class="label">Stand Size:</span> <span class="value">" . e($lead['stand_size']) . "</span></div>
        <div class="field"><span class="label">Sectors:</span> <span class="value">" . e($lead['sectors']) . "</span></div>
        <div class="field"><span class="label">Website:</span> <span class="value">" . e($lead['website']) . "</span></div>
        <div class="field"><span class="label">Message:</span></div>
        <div class="value">" . nl2br(e($lead['message'])) . "</div>
        <div class="footer">
            <p>Submitted on: " . e($lead['date']) . "</p>
            <p>Lead ID: #" . e($lead['id']) . "</p>
            <p><a href=\"https://ethiopiafoodexpo.com/admin/lead-detail.php?id=" . e($lead['id']) . "\">View in Admin Panel</a></p>
        </div>
    </div>
</body>
</html>
HTML;
    return ['subject' => $subject, 'body' => $body];
}

function getContactNotificationEmail($lead) {
    $subject = 'New Contact Message — ' . e($lead['name']);
    $body = <<<HTML
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <style>
        body { font-family: Arial, sans-serif; line-height: 1.6; color: #333; }
        .container { max-width: 600px; margin: 0 auto; padding: 20px; }
        h2 { color: #2e7d32; border-bottom: 2px solid #2e7d32; padding-bottom: 10px; }
        .field { margin-bottom: 12px; }
        .label { font-weight: bold; color: #555; }
        .value { color: #333; }
        .footer { margin-top: 30px; padding-top: 15px; border-top: 1px solid #ddd; font-size: 12px; color: #999; }
    </style>
</head>
<body>
    <div class="container">
        <h2>New Contact Message Received</h2>
        <p>A new contact message has been submitted on the Ethiopia Food Expo website.</p>
        <div class="field"><span class="label">Name:</span> <span class="value">" . e($lead['name']) . "</span></div>
        <div class="field"><span class="label">Email:</span> <span class="value"><a href=\"mailto:" . e($lead['email']) . "\">" . e($lead['email']) . "</a></span></div>
        <div class="field"><span class="label">Phone:</span> <span class="value">" . e($lead['phone']) . "</span></div>
        <div class="field"><span class="label">Company:</span> <span class="value">" . e($lead['company']) . "</span></div>
        <div class="field"><span class="label">Country:</span> <span class="value">" . e($lead['country']) . "</span></div>
        <div class="field"><span class="label">Message:</span></div>
        <div class="value">" . nl2br(e($lead['message'])) . "</div>
        <div class="footer">
            <p>Submitted on: " . e($lead['date']) . "</p>
            <p>Lead ID: #" . e($lead['id']) . "</p>
            <p><a href=\"https://ethiopiafoodexpo.com/admin/lead-detail.php?id=" . e($lead['id']) . "\">View in Admin Panel</a></p>
        </div>
    </div>
</body>
</html>
HTML;
    return ['subject' => $subject, 'body' => $body];
}
