Optimal Contracts when Enforcement is a Decision Variable