Hi, from whatever you have written, you may be having Depression. Depression is a Psychiatric disorder and it is treatable. You cannot snap out of Depression, proper treatment is required just like any other physical illness.
Please visit a Psychiatrist at the earliest.
Also, as you have written about weight gain, please get your
Thyroid tests done. Very often Hypothyroidism can be missed .
With a proper diagnosis and treatment plan you can definitely get better. Please do not delay, see a Psychiatrist soon.
In case you are suggested medication, make sure to follow it up with counseling, this will improve your coping mechanisms and you can handle life stressors in a better way.
Hope this helps, All the Best!