optimized generated classes

Made some optimizations in generated classes:

- fixed code style
- avoid IDE warnings
- added type hints
- some other fixes