Thermodynamics of an ideal generalized gas: I. Thermodynamic Laws