No one knows with certainty. For starters, the tests for covid disease have both false negatives and false positives, thus having been diagnosed as having Covid is not 100% accurate. Some tests are better than others. There is likely, but not proven, differences in the immunity conferred by clinical illness. In many diseases the sicker you are, the more vigorous your immune response. So a mild or asymptomatic case of Covid may not give as good protection against further attack. Again however, this is NOT yet established. Covid has only been around for a year so nobody can tell you what happens 18 months after the disease much less 5 years.
In the absence of excellent data, the prudent and recommended approach, at this time, is that regardless of a person's history of Covid disease,
they should still receive vaccination. It may be that at some time in the future that recommendation may change.