SELECT
    b.user_id as entity_id,
    b.email,
    b.user_joined_at,
    DATE_TRUNC('HOUR', b.most_recent_activity_date)
FROM SUNO_PROD.PROD.BOT_HOURLY b
WHERE b.meets_bot_definition
AND b.play_count = 0
AND b.are_clip_metrics_healthy
AND (
    matches_unplay_feature OR
    matches_hcaptcha_feature OR
    --matches_missing_geo_feature OR
    matches_email_domain_in_block_list_feature OR
    --  matches_email_domain_in_watch_list_feature OR
    matches_email_suspicion_feature OR
    matches_token_missing_feature OR
    matches_language_count_feature OR
    matches_ips_first_24_hours_feature OR
    matches_minutes_to_first_clip_feature OR
    matches_currently_jailed_feature OR
    matches_spam_mobile_carrier_bot_feature

)
AND b.most_recent_activity_date > DATEADD(DAY, -14, CURRENT_DATE)
ORDER BY
    DATE_TRUNC('HOUR', b.user_joined_at) DESC NULLS LAST,
    CASE WHEN b.email_domain IN ('outlook.com', 'hotmail.com') THEN 1 ELSE 0 END DESC,
    email_suspicion DESC
