<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
$_SESSION['user_id'] = 2; // Simulate logged in user
$_SERVER['REQUEST_METHOD'] = 'POST';
$_POST = [
    'channel_id' => 1,
    'content' => 'bha a vous de choisir !',
    'is_poll' => '1',
    'poll_title' => 'Test du sondage !',
    'poll_color' => '#f45571',
    'poll_choice_type' => 'single',
    'poll_end_date' => '20/02/2026 23:45',
    'poll_options' => '["Oui  je le veux !","Non je ne le veux pas !","Je ne sais pas encore !"]'
];

function getallheaders() { return []; }

// Mock session
if (session_status() === PHP_SESSION_NONE) {
    session_start();
}
$_SESSION['user_id'] = 2;

// Include the file
ob_start();
include 'api_v1_messages.php';
$output = ob_get_clean();

echo $output;
