Your search for "trailer wiring" revealed the following:
How Does a Trailer Breakaway System Work? Switch, Battery & Wiring Explained
Your normal trailer brakes depend on the tow vehicle and brake controller. A breakaway system exists for the moment those are no longer connected. If the trailer separates from the tow vehicle, a cable pulls the pin from the breakaway switch. That switch connects the trailer's onboard emergency battery to...
Repair the Wire or Rewire the Trailer? How to Know When You’re Done Patching
One bad trailer connection does not automatically mean the trailer needs to be rewired. But there is also a point where replacing another corroded connector, twisting together another broken wire, or chasing another intermittent light stops being a repair strategy. The question is not “Can this wire be patched?” The...