If you've spent the past few months missing deadlines, showing up late to work, and submitting error-ridden reports, getting fired might seem like a reasonable -- and predictable -- consequence, albeit an unfortunate one. But what happens when your company decides to let you go without warning? Do you have any rights?

In many cases, a company can, indeed, get away with firing you without so much as a tiny heads-up. But that doesn't mean you'll be rendered helpless, either.

Your rights as an employee

Most companies employ workers on an at-will basis. This means that the employer technically has the right to terminate the working relationship at any time and for any reason. It also means that your employer isn't required to give you warning about your termination unless you have a contract that specifically calls for a notice period. Therefore, if you're in an at-will arrangement and your company decides that your time on the job is up, you could find yourself out of luck.

Man in dress shirt and tie carrying cardboard box of office supplies.

IMAGE SOURCE: GETTY IMAGES.

That said, it's illegal for employers to terminate workers based on factors such as religion, age, race, sexual orientation, or disability. Therefore, if you have reason to believe that you're being let go because of one of these factors, it pays to consult an employment lawyer to review your options.

Here's an example. Imagine you tell your boss that you're pregnant, and two weeks later, you're terminated out of the blue, despite the fact that your performance record has thus far been stellar and there's still a need for the position you've been holding down. While your company can claim that you're not being fired due to your pregnancy, it might also have a hard time proving that should the attorney you hire choose to file a lawsuit. Therefore, in that situation, you might succeed in getting your job back, or, at the very least, snagging a generous severance package in exchange for your willingness to walk away.

Pay attention to warning signs

Because companies don't want to get sued every time they let an employee go, many put formal policies in place to protect themselves from such backlash. For example, a company might mandate that if a manager is displeased with a given worker's performance, he or she must put that person on a performance improvement plan and document its progress. This way, if that employee doesn't step up his or her game, the company can prove that it gave that worker a chance to do better before letting them go. If you've been put on such a plan, your job could hang in the balance.

If your company doesn't have a similar policy, pay attention to less obvious signs that could indicate you'll soon be on the chopping block. For example, if your boss starts criticizing your work more frequently and then fires you several months later, your company can argue that you did, in fact, receive feedback indicating that your performance wasn't up to par. On the other hand, if your boss has historically praised your work and only starts disapproving of it after you announce that you're pregnant, you should document when you had that conversation and when your manager's attitude shifted.

In an ideal world, employers would be required to give notice when they intend to fire someone, just as you, as an employee, are expected to give adequate notice before quitting. But unfortunately, that's not the way most employment agreements work, and technically speaking, your company can let you go at any time without really having to justify it. On the other hand, the moment the potential for discrimination comes into play, it's a very different story, so if you feel you've been a victim there, don't hesitate to enlist some legal help.