DMG page 188 said:8. Choose Equipment. Select weapons and armor from Chapter 7 of the Player’s Handbook, taking into account class and race.
You can give the NpC a magic item of a suitable level, but if he or she is an antagonist, count the item as part of the treasure for the adventure. (See “Awarding Treasure,” page 125, for more information.)
DMG page 187 said:If you gave the NpC a magic item that grants a bonus to defenses, you must also subtract the magic threshold from that bonus, as noted in the sidebar.