<?php
// test_telegram.php
// Test kirim notifikasi Telegram

include "config.php";
include "telegram_config.php";

header('Content-Type: application/json');

$test_message = "🧪 *TEST NOTIFIKASI TELEGRAM*\n\n";
$test_message .= "Waktu: " . date('d-m-Y H:i:s') . "\n";
$test_message .= "Status: ✅ Berhasil terhubung\n";
$test_message .= "Sistem: Absensi Digital\n";
$test_message .= "Chat ID Admin: " . TELEGRAM_CHAT_ID . "\n\n";
$test_message .= "_Ini adalah pesan test dari sistem absensi._";

$result = kirimTelegram($test_message);

if (strpos($result, 'berhasil') !== false) {
    echo json_encode([
        'status' => 'success',
        'message' => '✅ Notifikasi Telegram berhasil dikirim ke Admin! Chat ID: ' . TELEGRAM_CHAT_ID
    ]);
} else {
    echo json_encode([
        'status' => 'error',
        'message' => '❌ Gagal kirim Telegram: ' . $result
    ]);
}
?>