I am the patentee and entrust the factory to produce products. How can we sign a contract to prevent factory infringement?

Since the production is entrusted to the factory, we must first clarify the terms of the patent license, whether it is an exclusive license, an exclusive license or a general license, and whether the factory is allowed to sublicense. In addition, how to restrict the use, sale, manufacture, export and promised sales? We should also consider the confidentiality of technical secrets and the authorization of brands.