**Summary** In preparation for further work on auto file-type detection, improve `filetype.py` and related modules: - improve docstrings - improve type annotations - extract domain model to `.model` module