Fluids with internal degrees of freedom. I. Extended thermodynamics approach