Electric heat pump water heater with solar power vs. gas water heater
Is your water heater inside the home or outside? I ask this because heat pumps use heat transfer using the heat of the area they are in to create heat.
Ok to put it more simply if the water heater is inside the home when the water heater is extracting heat to store in the tank it is cooling that area just like an air conditioner would.
So are heat pumps more efficient inside the home envelope barely when compared to electric but compared to gas it will cost more. Also remember that 15 year old gas water heater that is still running , you now have a fancy electronic controlled thermal transfer system with a compressor to pump the process, do you think that will last as long as a new simple gas water heater?
I would gladly go back to gas, faster recovery and less monthly cost.
I you might think well I don’t like electric stuff.  I am a professional electrician that also has universal 608 and 609 (HVAC&amp;R  &amp; MVAC) licensees and I like gas better.
The only possible advantage is your electric utility may have incentives to go heat pump usually electric to electric but check.
My utility paid 99% of me installing my unit but I am licensed so most of the install cost was just my time.  Edit they gave me most of the cost of the heat pump unit.