  To investigate the relationship between gravity and thermodynamics in the
case of dynamic systems, we interpret the apparent horizon of the
Friedmann-Lema\^itre-Robertson-Walker (FLRW) spacetime as a thermodynamic
system. We derive the corresponding fundamental equation in the entropy
representation and explore the consequences of demanding the fulfillment of the
classical laws of thermodynamics. We investigate in detail the case of an FLRW
spacetime with and without cosmological constant. We show that the
interpretation of the apparent horizon as a thermodynamic system is possible
only under certain conditions because the analogy is not always valid for all
the values of the parameters entering the dynamics of the horizon and certainly
not for its entire evolution.
