<?php
require_once __DIR__.'/../includes/functions.php';
header('Content-Type: text/plain');
$summary = [
 'unread_alerts'=>mj_admin_unread_alert_count(),
 'pending_listings'=>mj_module_count('mj_listings',"status='pending'"),
 'pending_companies'=>mj_module_count('mj_companies',"status='pending'"),
 'errors_today'=>mj_module_count('mj_error_logs',"DATE(created_at)=CURDATE()")
];
mj_create_admin_alert(['alert_key'=>'daily_digest_'.date('Ymd'),'alert_type'=>'admin_digest','module_name'=>'daily_digest','priority'=>'normal','title'=>'Daily Admin Summary','message'=>mj_safe_json($summary),'action_url'=>'admin-actions.php']);
echo "Daily digest created\n";
