Join a Union. The bitter truth is your employer has a lot more lawyers than you do. For all the talk about how well-compensated and in-demand tech workers are, the reality is usually different. You need someone in your corner to help you fight for your rights. If you're a tech worker in the UK, you can get three months free membership at https://prospect.org.uk/join/
Join. A. Union. https://utaw.tech/join/ also good. Think of it as having an employment lawyer on retainer for £8 a month. Well worth the money.
Join a union when things are good, to help you when things are bad.