Architecture of mobile applications. Where MapIT model?

Server API gives json of the form:
{ "zones": [{ 
"id":28,
 "name":"zone 1"
}
 ], "subzones":[{ 
"id":15,
"zone_id":28,
 "name":"subzone 1"
}]}


Respectively, have in the code two models Zone.java and Subzone.java:
public class Zone {
 int id;
 String name;
}
public class Subzone {
 int id;
 int zone_id;
 String name;
}


Task: make a list of zones with subzones and a checkbox, for example:
Zone 1 o
-subzone 1 on
-subzone 2 v
Zone 2 v
-subzone 1 v
...


Ie for a list of models will differ: there will be flag isChecked have UiZone field List subzones. And both classes will inherit from one class, relatively RecyclerItem to display in a single list.

The project has the following structure

EN.org.project
|-App
|-network
|--Api
|--entities
|---Zone
|---Subzone
|-ui
|--entities
|---RecyclerItem
|---UiZone
|---UiSubzone
|--screen
|---adapter
|---activity

Actually the question from the title: where is the best place to make the mapping patterns between layers server Model | application Model | Ui Model?

Do I need to duplicate the entire server model in the application model, if they do not differ?

My thoughts: have seen the approach where the singleton Repository/DataManager positive muppet, features, and returns a corresponding UI model, but what if we have multiple screens and each one needs a kind of UiZone/UiSubzone condition and these models need to be stored while the process is alive(i.e., storing in the database is unnecessary). In such cases, you really want to expand server model all possible ui fields and other things.
April 4th 20 at 00:47
0 answer

Find more questions by tags AndroidDesigning software