always a good reminder for the freelancers out there, educate yourself a little on legalese. I'm not an expert by any means, but a little competency goes a long way.
I recommend the Graphic Artists Guild Handbook as a good reference for this as they have example contracts. I got recommended this early on in my career by a mentor of mine, and it changed how I approached running a freelance business: https://graphicartistsguild.org/the-graphic-artists-guild-handbook-pricing-ethical-guidelines/