Get distinct flatten array

How to get merged actions base on role from below doc

{
“type”: “role”,
“roles”: [
{
“role”: “Key Manager”,
“actions”: [
“ANK”
]
},
{
“role”: “Client Manager”,
“actions”: [
“ANC”
]
}
]
}

Input is array of Role [“key Manager”,“Client Manager”]
Output :[“ANC”,ANK]

  ARRAY_DISTINCT(
          ARRAY_FLATTEN(ARRAY v.actions 
                        FOR v IN roles 
                        WHEN v.`role` IN  ["key Manager","Client Manager"] 
                        END, 1)
       )