  Since the suggestion of relativistic shocks as the origin of gamma-ray bursts
(GRBs) in early 90's, the mathematical formulation of this process has stayed
at phenomenological level. One of the reasons for the slow development of
theoretical works in this domain has been the simple power-law behaviour of the
afterglows hours or days after the prompt gamma-ray emission. Nowadays with the
launch of the Swift satellite, gamma-ray bursts can be observed in
multi-wavelength from a few tens of seconds after trigger onward. These
observations have leaded to the discovery of features unexplainable by the
simple formulation of the shocks and emission processes used up to now. But
"devil is in details" and some of these features may be explained with a more
detailed formulation of phenomena and without adhoc addition of new processes.
Such a formulation is the goal of this work. We present a consistent
formulation of the collision between two spherical relativistic shells. The
model can be applied to both internal and external shocks. Notably, we propose
two phenomenological models for the evolution of the emitting region during the
collision. One of these models is more suitable for the internal shocks and the
other for the external collisions. We calculate radiation flux, lags, and
hardness ratios. One of our aims has been a formulation enough complex to
include the essential processes, but enough simple such that the data can be
directly compared with the theory to extract the value and evolution of
physical quantities. To accomplish this goal, we also suggest a procedure for
extracting parameters of the model from data. In a following paper we
numerically calculate the evolution of some simulated models and compare their
features with the properties of the observed gamma-ray bursts.(abbreviated)
