Brooklyn on Wednesday agreed to terms on a trade with the Hornets that will send Dwight Howard to the Nets in exchange for Timofey Mozgov, two second-round picks and cash, according to multiple reports.

The deal won’t become official until the moratorium ends July 6. Charlotte receives the Nets’ 45th overall pick in Thursday’s draft along with a 2021 second-rounder, according to ESPN.

This is a salary-cap play for the Nets, who will now have space for two max contracts in the summer of 2019, when the free-agent class could include both Kawhi Leonard and Kyrie Irving, among other marquee players. Howard is entering the final season of a three-year, $70.5 million deal he signed with the Hawks in 2016, and this expiring contract is a valuable asset for GM Sean Marks and the Nets front office.

Howard, 32, is due just under $24 million this season. The Nets will reportedly save just under $17 million in cap space when Howard’s contract expires next summer. They could potentially buy Howard out to avoid having him on their roster next season. That won’t change their cap savings for 2019-20.

The Nets acquired Mozgov and his outrageously lucrative contract in the D’Angelo Russell trade with the Lakers last June. Los Angeles signed Mozgov to a four-year, $64 million deal in 2016. The former Knick still has two more years remaining on that contract. By swapping Mozgov for Howard, the Nets are effectively creating cap space for next summer as opposed to the summer of 2020.

The Nets will still have two picks in Thursday’s draft after this trade. They’ll select 29th in the first round — a pick they accrued in the Demarre Carroll trade last summer. Then they’ll draft 40th overall, via the Lakers.

Howard, an eight-time All-Star, averaged 16.2 points, 12.5 rebounds and 1.6 blocks per game for the Hornets last season. He is now on his fourth team in the last four years — a number that could grow if he and the Nets can agree to buyout.

The Nets already have two true centers on their roster in Jarrett Allen and Jahlil Okafor. There doesn’t appear to be room for Howard.