<?php

declare(strict_types=1);

namespace App\Models;

use App\Core\Database;

/**
 * Journal des messages de contact (sauvegarde en plus de l'email).
 */
final class ContactMessage
{
    public static function create(string $name, string $email, string $message, ?string $ip): void
    {
        $pdo = Database::connection();
        $pdo->prepare('INSERT INTO contact_messages (name, email, message, ip) VALUES (:n, :e, :m, :ip)')
            ->execute(['n' => $name, 'e' => $email, 'm' => $message, 'ip' => $ip]);
    }
}
