for the custom model data, use model_data: <number>
https://wiki.helpch.at/clips-plugins/deluxemenus/options-and-configurations/item#model-data
for equiping/unequiping the hat, I don't know any command for that, try asking Oraxen's devs if they have smth like that or if they can add it
For the last part, you'll need to make 3 items:
- the Unlocked item with a priority of 0 that has a view_requirement checking for if you have the rank,
- the Not Owned item where you have a priority of 1 and a view requirement checking if you have the permission to unlock it
- and the Locked item with a priority of 2 and no view_requirement