This isn't one of those games where the goal is to use only this bag of parts, right?
Charge the battery with the solar panel
Simply connecting a solar panel to a battery will not do what you want. It will overcharge and wreck the battery. You need a charge controller between panel and battery. This is a keystone product that will make or break your build.
Good ones are hard to find. Generally the ones sold at chain/big-box retail stores are foreign dreck, often with reputable brand names slapped on them. I prefer using a low-end controller from a well-reputed company in the solar business like Morningstar. Unfortunately many of these are specialty products, so you just have to read up on solar-power forums and places like that to see who's regarded as the best.
From there, it's a simple affair to connect solar panel to charge controller, and charge controller to battery.
A good charge controller will not need you to throw switches or change wires.
Hook up your loads
Since your goal is lighting, get 12V lights. The point is to use 12V lighting throughout, run straight off the battery. Don't even think of running an inverter to run 120V lighting, that's just crazy.
Off-grid power is too precious to use anything but LEDs for lighting. Nothing else is efficient enough. You don't want to double your battery and solar just to run CFLs, or 7x your battery and solar to run incandescents. That's just crazy. No, LEDs are not ugly light (more on that). Yes, the government forcing swirly CFLs is unfair, but LED is also winning fair-and-square because it's better.
You can get 12V LED lighting in all sorts of shapes and sizes:
Be careful with your choice of color temperature and CRI when buying LEDs. A lot of the early or cheap LEDs had poor CRI and harsh color temperatures, and they got a bit of a reputation. These days you can get any CRI or color temperature you want.
CRI is Color Rendering Index, or how good the light looks to humans; aim for 80 or up (out of 100). Color temperature is how "blue" the light is. The traditional warm incandescent lighting is 2700-3000K (kelvin, weird unit, I know). 4100K is office fluorescent lights. 5100K is a cloudy day, blue-sky is 6500, and that sounds great when you're buying it, but it looks awful at night. Try to have all your LEDs be about the same color temperature.
Make a very serious effort to find 12V versions of anything else you want to run. These days a lot of flatscreen TVs are 12V friendly. Boaters, RVers, tiny-house and VanLife people have good sources.
Inverting to make 120V involves a serious amount of energy loss. Even an inverter sitting idle has a fairly high power consumption.
You can't run them 24x7 or they'll destroy your battery. In fact, don't neatly install one. Leave it something you temporarily hook up in a tangled mess, so you'll remember to unhook it and put it away.
Don't overwork the battery
Both your batteries are lead-acid type. That particular type has a serious problem: it *really, really does not like being deep-cycled.** Deep-cycle lead-acids, like your Optima yellowtops, do better -- but they still will be destroyed by deep cycling, just will get more cycles before they do (on the upper range of the numbers I'm about to give).
- If you drain it dead, you'll get 5-30 cycles before battery death
- If you drain to 50%, maybe 20-200 cycles
- if only 25% DOD (using 25% of capacity) many hundreds of cycles
- 15% DOD thousands of cycles.
Factor this against the fact that lead-acid batteries typically fail anyway after 5-7 years. The upshot is, depending on your usage, you may need a larger battery for this system to make sense. Or...
Other battery types
You may think "Wait, my laptop/iPad/phone doesn't have that problem!" Correct. But before you start salvaging 18650's out of laptop batteries, lithiums have a different problem: spectacular battery fires. To avoid that, you need to build battery packs carefully and include a protection circuit - many people are doing this for off-grid / home-power. There are lots of instructionals out there, some not so safe.
There are more traditional battery types such as the famous NiFe "Edison battery" or its brothers NiCd or NiMH. But you're not going to find those on the cheap.