I'm going to cut against the grain here, but I have good reason for it.
If you are talking strictly defense, buy a pistol, something you are comfortable handling first and foremost. People always say get a shotgun or an AR for the home, but... you clearly have shit for experience when it comes to weapons, and you aren't an IRL CoD character, so you don't know shit about CQB with a large, unwieldy weapon system.
Go to a range, put like 50 rounds through multiple different types of pistols (hammer fire vs striker, revolver vs semi-auto). Then go home, and come back another day and do it again. Then go home and research more recommendations based off of what you liked better. Then go back and try a couple of those recommendations, then buy your pistol. Not only will you be way more confident in your purchase, but you'll be happy to shoot it, happy to clean it, happy to store it in that quick to find spot.
I say all this because I can easily give recommendations, but they are my opinions based on my preferences, my experiences, my usage, etc... case in point, a lot of people like Glocks. Some say they are the best pistols, blah blah blah. I fucking hate Glocks, I haven't yet fired any striker pistol I've wanted to do more than a magazine of rounds out of. I never recommend glocks.
You may find that Glocks are your favorite thing, and you just want to shoot it all day long. Neither of us is wrong. But if I recommend HK to you, or CZ, or 1911s, or hell I have a soft spot for the Beretta 92fs (often a neutral to disliked product), and you go out an spend your hard earned money on it and don't like it, it's going to sit in a box, probably neglected, and you'll think shooting is stupid.
This got long, last thing on ARs and Shotguns. Like I said these aren't great "house" weapons for untrained people. Hell shotguns are generally not designed with indoors and traditional cqb positioning, and ARs.. well they are rifles, designed with the average engagement range of their host military, so for the M16 (AR) and the 556 NATO it fires that designed engagement range of around 30 to 100m (Vietnam) which all the current weapon system development is with Afghan in mind which is 500-600m (which has been pushing alternative rifles forward because 550 is the point range on an AR). We use these weapons in houses and buildings, but they aren't great at them. And we go through hundreds of hours of urban training and most people still aren't great at slinging shotguns and m16s or m4s around corners.
And really if multiple people enter your home and don't scatter the second you put 2 into their buddies sternum, a high capacity magazine or buck shot isn't going to change the fact you are in for a very unpleasant death.