Been awhile since I really did cap stuff, but:
Cliff Notes:
Cap is a hard cap (no signing other team's free agents to exceed the cap, except for the exceptions below) (Brunson would fall under the Bird Rights category)
Luxury cap: There is a secondary cap that works as a penalty for teams the exceed the hard cap by a set percentage. Teams have to pay a penalty to the league for exceeding the luxury cap. The more consecutive years a team spends above the cap the worse the penalty gets.
Early Bird Rights: For a player that has been under contract for 2 years or with the same team for 2 years, the team that they're on when their contract expires can sign them for a set value (105% of league average or 175% of previous salary, whichever is higher). They can go over the hard cap for this.
Bird Rights: For players that have been on a contract for 3+ years, or on the same team for 3 consecutive years, they can sign them for a contract substantially over the hard cap depending on their seniority.
Trades: teams have to send out as much as they bring back in salary. Under cap teams can create a phantom contract called a trade exception to balance trades. Trade exceptions can be traded for only one player.
Exceptions:
Mid-level exceptions: Non-Tax Payer: teams not paying the tax can go over the cap by the league average contract.
Tax Payer: Teams paying the tax get a lesser exception every year to increase their cap figure.
Room exception: teams under the cap get an exception to go over the cap once they hit the cap.
Bi-annual exception: lower level contracts to go over the cap.
If you look up the terms you can understand them better than my summary, and I readily admit things may have changed in the last 5+ years that I haven't been paying relatively close attention to CBA deals.