-- LOT 11.14 - controles non destructifs license_usage_stats
-- A executer uniquement si besoin de verifier le deploiement apres le prochain check PLACE.

SELECT id, license_id, event_type, payload_json, created_at
FROM license_audit_log
WHERE license_id = 1
ORDER BY id DESC
LIMIT 10;

SELECT id, license_id, computed_at, rolling_365_course_count, sms_sent_count,
       active_events_count, active_runs_count, source, details_json, created_at
FROM license_usage_stats
WHERE license_id = 1
ORDER BY id DESC
LIMIT 10;

-- La ligne attendue apres redemarrage PLACE doit contenir :
-- source = 'PLACE_LICENSE_CHECK'
-- rolling_365_course_count = 20
-- sms_sent_count >= 3
-- active_events_count = 2
-- active_runs_count = 2
