Подробно описал в ТЗ https://docs.google.com/document/d/1pSOR6kl5Y4Ukle4f0q5YKfD_-ROb0pw7uQo8lnXqLtc/edit?usp=sharing