Mutiple url rewrite rules and get every params

I am creating a messaging system where I have 4 sections (1)inbox (2)sent (3)draft (4)unread so I decide to go with WordPress add rewrite rules

I already add one rewrite rule section.

Now I want to add one more param after section is ID(inbox messages id).

so for that I add second rewrite rule id.

if I visit https://example.com/messages/inbox I can get in query_vars

but issue is that if I visit https://example.com/messages/inbox/123 I can get in query_vars

I am not getting section value in this case I want check in this URL that which section Is currently that’s why i need section value in this page.

Please help me with that. Thank you.