I'm studying Magento and I'm confusing about the differences between these four layers. What I have understood is the following:
Is the entity class with ONLY getters/setters and magic methods.
Is the layer responsible of C.R.U.D operations. This class should contains ONLY the
_construct method to map my entity with the database table.
As the name suggested, it's a class that implements IterableInterface and give me only a list of Entity.
It's a class that expose API methods to the external and it's also used to execute operations to database. It's used to save/load/delete entity (internally I think that for these CRUD operations it should use the ResourceModel) and to expose methods to get collections of results.
It's the interface that Model should implement.
It's the interface that Repository should implement.
But not all Magento modules work in this way, so there are modules that don't use this approach yet, but for compatibility reasons they use the old approach. Is it correct what I learned to it?