-- Test the backend integration by inserting a test post and checking moderation
-- First, let's see if there are any existing moderation flags

SELECT 'Current moderation flags:' as info;
SELECT COUNT(*) as total_flags FROM moderation_flags;

SELECT 'Recent moderation activity:' as info;
SELECT 
    flag_reason,
    status,
    scores,
    created_at
FROM moderation_flags 
ORDER BY created_at DESC 
LIMIT 5;

-- Test the Three Poisons scoring with a sample flag
SELECT 'Inserting test moderation flag:' as info;

INSERT INTO moderation_flags (
    post_id, 
    flag_reason, 
    scores, 
    status
) VALUES (
    gen_random_uuid(),
    'hate',
    '{"hate": 0.8, "greed": 0.1, "delusion": 0.2}',
    'pending'
);

SELECT 'Test flag inserted. Current status:' as info;
SELECT 
    flag_reason,
    status,
    scores,
    created_at
FROM moderation_flags 
ORDER BY created_at DESC 
LIMIT 3;
