Write a SQL query using window functions to rank users by engagement within each country.
Calculate each user's engagement as the sum of the weights for their recorded events. Include users who have no events, assign tied users the same rank, and exclude users whose country is not represented in the countries table.
Output
- One row per included user with
country_code, country_name, user_id, username, engagement_score, and country_rank.
- Sort by
country_code, country_rank ascending, then user_id ascending.