Makes erod_document and erod_factory behaviours.

* Added the erdo_factory behaviour.
* Made erod_document into a behaviour.
* Moved all types definitions to erod module and xported the types.