-- Test comprehensive AI moderation for all content types
-- Clear existing test data
DELETE FROM moderation_flags WHERE flag_reason IN ('test_text', 'test_image', 'test_video', 'test_comment');

-- Test 1: Text-only post moderation
INSERT INTO moderation_flags (
    post_id, 
    flag_reason, 
    scores, 
    status,
    created_at
) VALUES (
    gen_random_uuid(),
    'test_text',
    '{"hate": 0.7, "greed": 0.2, "delusion": 0.1}',
    'pending',
    NOW()
);

-- Test 2: Image content moderation  
INSERT INTO moderation_flags (
    post_id, 
    flag_reason, 
    scores, 
    status,
    created_at
) VALUES (
    gen_random_uuid(),
    'test_image',
    '{"hate": 0.3, "greed": 0.6, "delusion": 0.2}',
    'pending',
    NOW()
);

-- Test 3: Video content moderation
INSERT INTO moderation_flags (
    post_id, 
    flag_reason, 
    scores, 
    status,
    created_at
) VALUES (
    gen_random_uuid(),
    'test_video',
    '{"hate": 0.4, "greed": 0.3, "delusion": 0.5}',
    'pending',
    NOW()
);

-- Test 4: Comment moderation
INSERT INTO moderation_flags (
    comment_id, 
    flag_reason, 
    scores, 
    status,
    created_at
) VALUES (
    gen_random_uuid(),
    'test_comment',
    '{"hate": 0.8, "greed": 0.1, "delusion": 0.3}',
    'pending',
    NOW()
);

-- Verify all test flags were created
SELECT 'Comprehensive Moderation Test Results:' as info;
SELECT 
    flag_reason,
    CASE 
        WHEN post_id IS NOT NULL AND comment_id IS NULL THEN 'Post'
        WHEN comment_id IS NOT NULL AND post_id IS NULL THEN 'Comment'
        ELSE 'Unknown'
    END as content_type,
    status,
    scores,
    created_at
FROM moderation_flags 
WHERE flag_reason IN ('test_text', 'test_image', 'test_video', 'test_comment')
ORDER BY created_at;

SELECT 'Total flags in system:' as info;
SELECT COUNT(*) as total_flags FROM moderation_flags;
