first you need to decide what the primary use of the gun is, one gun will not fill every roll, it takes several
here is my collection to give you an idea,
AK-74, -my SHTF gun
Saiga 20(Russian AK designed 20 gauge)- indoor SHTF gun.
Remington 700 SPS in 308 - my long range gun (300-800 yard shots)
Remington 12 gauge pump, bird and small critter hunting gun.
Magnum research 22 MAGNUM semi-auto, for those long range (75-150 yard) squirrel or bird shots.
Walther PPS, in .40 S&W my CCW
Walther PPK in .380 my backup CCW
no one gun will do it all,
if it is home protection, and I could only get one gun a Mossburg 500 in 12 gauge will hold 7+1 I believe.
and would work great against one or several intruders, no pistol really can compete with it.
the only benefit of a pistol is it is smaller, easier to conceal, and a bit more maneuverable, and you can forget about making a shot past 75 feet or so, it's possible but is a low percentage shot. and the bullet speed drops off quick.
if you want a Rifle for SHTF I would recommend a AK-74, the newer version of the AK-47, only it shoots the 5.45x39round, and surplus ammo is SUPER cheap
at around 14 cents a round vs over a dollar a round for something like 308 ammo.
a Saiga (real Russian made AK-74) can be bought for 475 but will not have the pistol grip, (they have to be built to sporter configuration for import)
but can be converted super easy, if you want for pretty cheap,
if you want a pistol there are lots of good quality guns, I would not recommend anything smaller than a 9mm. personally I like the walther pistols but a Springfield XDM is a great gun as well, you might find a used one in that price range.
and you cant beat the reliability of an AK.
AK-74 is sporter configuration