user_me_entity.g.dart 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/user_me_entity.dart';
  3. UserMeEntity $UserMeEntityFromJson(Map<String, dynamic> json) {
  4. final UserMeEntity userMeEntity = UserMeEntity();
  5. final String? id = jsonConvert.convert<String>(json['id']);
  6. if (id != null) {
  7. userMeEntity.id = id;
  8. }
  9. final String? name = jsonConvert.convert<String>(json['name']);
  10. if (name != null) {
  11. userMeEntity.name = name;
  12. }
  13. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  14. if (avatar != null) {
  15. userMeEntity.avatar = avatar;
  16. }
  17. final String? phone = jsonConvert.convert<String>(json['phone']);
  18. if (phone != null) {
  19. userMeEntity.phone = phone;
  20. }
  21. final String? email = jsonConvert.convert<String>(json['email']);
  22. if (email != null) {
  23. userMeEntity.email = email;
  24. }
  25. final String? followsCount = jsonConvert.convert<String>(json['follows_count']);
  26. if (followsCount != null) {
  27. userMeEntity.followsCount = followsCount;
  28. }
  29. final String? flowersCount = jsonConvert.convert<String>(json['flowers_count']);
  30. if (flowersCount != null) {
  31. userMeEntity.flowersCount = flowersCount;
  32. }
  33. final String? postsCount = jsonConvert.convert<String>(json['posts_count']);
  34. if (postsCount != null) {
  35. userMeEntity.postsCount = postsCount;
  36. }
  37. final List<UserMeHouseholds>? households = (json['households'] as List<dynamic>?)?.map(
  38. (e) => jsonConvert.convert<UserMeHouseholds>(e) as UserMeHouseholds).toList();
  39. if (households != null) {
  40. userMeEntity.households = households;
  41. }
  42. final List<UserMeEstates>? estates = (json['estates'] as List<dynamic>?)?.map(
  43. (e) => jsonConvert.convert<UserMeEstates>(e) as UserMeEstates).toList();
  44. if (estates != null) {
  45. userMeEntity.estates = estates;
  46. }
  47. final UserMeDefaultUnit? defaultUnit = jsonConvert.convert<UserMeDefaultUnit>(json['default_unit']);
  48. if (defaultUnit != null) {
  49. userMeEntity.defaultUnit = defaultUnit;
  50. }
  51. final UserMeInformation? information = jsonConvert.convert<UserMeInformation>(json['information']);
  52. if (information != null) {
  53. userMeEntity.information = information;
  54. }
  55. return userMeEntity;
  56. }
  57. Map<String, dynamic> $UserMeEntityToJson(UserMeEntity entity) {
  58. final Map<String, dynamic> data = <String, dynamic>{};
  59. data['id'] = entity.id;
  60. data['name'] = entity.name;
  61. data['avatar'] = entity.avatar;
  62. data['phone'] = entity.phone;
  63. data['email'] = entity.email;
  64. data['follows_count'] = entity.followsCount;
  65. data['flowers_count'] = entity.flowersCount;
  66. data['posts_count'] = entity.postsCount;
  67. data['households'] = entity.households?.map((v) => v.toJson()).toList();
  68. data['estates'] = entity.estates?.map((v) => v.toJson()).toList();
  69. data['default_unit'] = entity.defaultUnit?.toJson();
  70. data['information'] = entity.information?.toJson();
  71. return data;
  72. }
  73. extension UserMeEntityExtension on UserMeEntity {
  74. UserMeEntity copyWith({
  75. String? id,
  76. String? name,
  77. String? avatar,
  78. String? phone,
  79. String? email,
  80. String? followsCount,
  81. String? flowersCount,
  82. String? postsCount,
  83. List<UserMeHouseholds>? households,
  84. List<UserMeEstates>? estates,
  85. UserMeDefaultUnit? defaultUnit,
  86. UserMeInformation? information,
  87. }) {
  88. return UserMeEntity()
  89. ..id = id ?? this.id
  90. ..name = name ?? this.name
  91. ..avatar = avatar ?? this.avatar
  92. ..phone = phone ?? this.phone
  93. ..email = email ?? this.email
  94. ..followsCount = followsCount ?? this.followsCount
  95. ..flowersCount = flowersCount ?? this.flowersCount
  96. ..postsCount = postsCount ?? this.postsCount
  97. ..households = households ?? this.households
  98. ..estates = estates ?? this.estates
  99. ..defaultUnit = defaultUnit ?? this.defaultUnit
  100. ..information = information ?? this.information;
  101. }
  102. }
  103. UserMeHouseholds $UserMeHouseholdsFromJson(Map<String, dynamic> json) {
  104. final UserMeHouseholds userMeHouseholds = UserMeHouseholds();
  105. final String? id = jsonConvert.convert<String>(json['id']);
  106. if (id != null) {
  107. userMeHouseholds.id = id;
  108. }
  109. final String? name = jsonConvert.convert<String>(json['name']);
  110. if (name != null) {
  111. userMeHouseholds.name = name;
  112. }
  113. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  114. if (avatar != null) {
  115. userMeHouseholds.avatar = avatar;
  116. }
  117. return userMeHouseholds;
  118. }
  119. Map<String, dynamic> $UserMeHouseholdsToJson(UserMeHouseholds entity) {
  120. final Map<String, dynamic> data = <String, dynamic>{};
  121. data['id'] = entity.id;
  122. data['name'] = entity.name;
  123. data['avatar'] = entity.avatar;
  124. return data;
  125. }
  126. extension UserMeHouseholdsExtension on UserMeHouseholds {
  127. UserMeHouseholds copyWith({
  128. String? id,
  129. String? name,
  130. String? avatar,
  131. }) {
  132. return UserMeHouseholds()
  133. ..id = id ?? this.id
  134. ..name = name ?? this.name
  135. ..avatar = avatar ?? this.avatar;
  136. }
  137. }
  138. UserMeEstates $UserMeEstatesFromJson(Map<String, dynamic> json) {
  139. final UserMeEstates userMeEstates = UserMeEstates();
  140. final String? id = jsonConvert.convert<String>(json['id']);
  141. if (id != null) {
  142. userMeEstates.id = id;
  143. }
  144. final String? name = jsonConvert.convert<String>(json['name']);
  145. if (name != null) {
  146. userMeEstates.name = name;
  147. }
  148. final List<UserMeEstatesAccounts>? accounts = (json['accounts'] as List<dynamic>?)?.map(
  149. (e) => jsonConvert.convert<UserMeEstatesAccounts>(e) as UserMeEstatesAccounts).toList();
  150. if (accounts != null) {
  151. userMeEstates.accounts = accounts;
  152. }
  153. return userMeEstates;
  154. }
  155. Map<String, dynamic> $UserMeEstatesToJson(UserMeEstates entity) {
  156. final Map<String, dynamic> data = <String, dynamic>{};
  157. data['id'] = entity.id;
  158. data['name'] = entity.name;
  159. data['accounts'] = entity.accounts?.map((v) => v.toJson()).toList();
  160. return data;
  161. }
  162. extension UserMeEstatesExtension on UserMeEstates {
  163. UserMeEstates copyWith({
  164. String? id,
  165. String? name,
  166. List<UserMeEstatesAccounts>? accounts,
  167. }) {
  168. return UserMeEstates()
  169. ..id = id ?? this.id
  170. ..name = name ?? this.name
  171. ..accounts = accounts ?? this.accounts;
  172. }
  173. }
  174. UserMeEstatesAccounts $UserMeEstatesAccountsFromJson(Map<String, dynamic> json) {
  175. final UserMeEstatesAccounts userMeEstatesAccounts = UserMeEstatesAccounts();
  176. final String? id = jsonConvert.convert<String>(json['id']);
  177. if (id != null) {
  178. userMeEstatesAccounts.id = id;
  179. }
  180. final String? name = jsonConvert.convert<String>(json['name']);
  181. if (name != null) {
  182. userMeEstatesAccounts.name = name;
  183. }
  184. final String? avatar = jsonConvert.convert<String>(json['avatar']);
  185. if (avatar != null) {
  186. userMeEstatesAccounts.avatar = avatar;
  187. }
  188. final String? type = jsonConvert.convert<String>(json['type']);
  189. if (type != null) {
  190. userMeEstatesAccounts.type = type;
  191. }
  192. final int? isDefault = jsonConvert.convert<int>(json['default']);
  193. if (isDefault != null) {
  194. userMeEstatesAccounts.isDefault = isDefault;
  195. }
  196. final String? status = jsonConvert.convert<String>(json['status']);
  197. if (status != null) {
  198. userMeEstatesAccounts.status = status;
  199. }
  200. final UserMeEstatesAccountsUnit? unit = jsonConvert.convert<UserMeEstatesAccountsUnit>(json['unit']);
  201. if (unit != null) {
  202. userMeEstatesAccounts.unit = unit;
  203. }
  204. return userMeEstatesAccounts;
  205. }
  206. Map<String, dynamic> $UserMeEstatesAccountsToJson(UserMeEstatesAccounts entity) {
  207. final Map<String, dynamic> data = <String, dynamic>{};
  208. data['id'] = entity.id;
  209. data['name'] = entity.name;
  210. data['avatar'] = entity.avatar;
  211. data['type'] = entity.type;
  212. data['default'] = entity.isDefault;
  213. data['status'] = entity.status;
  214. data['unit'] = entity.unit?.toJson();
  215. return data;
  216. }
  217. extension UserMeEstatesAccountsExtension on UserMeEstatesAccounts {
  218. UserMeEstatesAccounts copyWith({
  219. String? id,
  220. String? name,
  221. String? avatar,
  222. String? type,
  223. int? isDefault,
  224. String? status,
  225. UserMeEstatesAccountsUnit? unit,
  226. }) {
  227. return UserMeEstatesAccounts()
  228. ..id = id ?? this.id
  229. ..name = name ?? this.name
  230. ..avatar = avatar ?? this.avatar
  231. ..type = type ?? this.type
  232. ..isDefault = isDefault ?? this.isDefault
  233. ..status = status ?? this.status
  234. ..unit = unit ?? this.unit;
  235. }
  236. }
  237. UserMeEstatesAccountsUnit $UserMeEstatesAccountsUnitFromJson(Map<String, dynamic> json) {
  238. final UserMeEstatesAccountsUnit userMeEstatesAccountsUnit = UserMeEstatesAccountsUnit();
  239. final String? id = jsonConvert.convert<String>(json['id']);
  240. if (id != null) {
  241. userMeEstatesAccountsUnit.id = id;
  242. }
  243. final String? block = jsonConvert.convert<String>(json['block']);
  244. if (block != null) {
  245. userMeEstatesAccountsUnit.block = block;
  246. }
  247. final String? street = jsonConvert.convert<String>(json['street']);
  248. if (street != null) {
  249. userMeEstatesAccountsUnit.street = street;
  250. }
  251. final String? unit = jsonConvert.convert<String>(json['unit']);
  252. if (unit != null) {
  253. userMeEstatesAccountsUnit.unit = unit;
  254. }
  255. final String? address = jsonConvert.convert<String>(json['address']);
  256. if (address != null) {
  257. userMeEstatesAccountsUnit.address = address;
  258. }
  259. return userMeEstatesAccountsUnit;
  260. }
  261. Map<String, dynamic> $UserMeEstatesAccountsUnitToJson(UserMeEstatesAccountsUnit entity) {
  262. final Map<String, dynamic> data = <String, dynamic>{};
  263. data['id'] = entity.id;
  264. data['block'] = entity.block;
  265. data['street'] = entity.street;
  266. data['unit'] = entity.unit;
  267. data['address'] = entity.address;
  268. return data;
  269. }
  270. extension UserMeEstatesAccountsUnitExtension on UserMeEstatesAccountsUnit {
  271. UserMeEstatesAccountsUnit copyWith({
  272. String? id,
  273. String? block,
  274. String? street,
  275. String? unit,
  276. String? address,
  277. }) {
  278. return UserMeEstatesAccountsUnit()
  279. ..id = id ?? this.id
  280. ..block = block ?? this.block
  281. ..street = street ?? this.street
  282. ..unit = unit ?? this.unit
  283. ..address = address ?? this.address;
  284. }
  285. }
  286. UserMeDefaultUnit $UserMeDefaultUnitFromJson(Map<String, dynamic> json) {
  287. final UserMeDefaultUnit userMeDefaultUnit = UserMeDefaultUnit();
  288. final String? id = jsonConvert.convert<String>(json['id']);
  289. if (id != null) {
  290. userMeDefaultUnit.id = id;
  291. }
  292. final String? estateId = jsonConvert.convert<String>(json['estate_id']);
  293. if (estateId != null) {
  294. userMeDefaultUnit.estateId = estateId;
  295. }
  296. final String? block = jsonConvert.convert<String>(json['block']);
  297. if (block != null) {
  298. userMeDefaultUnit.block = block;
  299. }
  300. final String? street = jsonConvert.convert<String>(json['street']);
  301. if (street != null) {
  302. userMeDefaultUnit.street = street;
  303. }
  304. final String? unit = jsonConvert.convert<String>(json['unit']);
  305. if (unit != null) {
  306. userMeDefaultUnit.unit = unit;
  307. }
  308. final String? address = jsonConvert.convert<String>(json['address']);
  309. if (address != null) {
  310. userMeDefaultUnit.address = address;
  311. }
  312. final int? type = jsonConvert.convert<int>(json['type']);
  313. if (type != null) {
  314. userMeDefaultUnit.type = type;
  315. }
  316. return userMeDefaultUnit;
  317. }
  318. Map<String, dynamic> $UserMeDefaultUnitToJson(UserMeDefaultUnit entity) {
  319. final Map<String, dynamic> data = <String, dynamic>{};
  320. data['id'] = entity.id;
  321. data['estate_id'] = entity.estateId;
  322. data['block'] = entity.block;
  323. data['street'] = entity.street;
  324. data['unit'] = entity.unit;
  325. data['address'] = entity.address;
  326. data['type'] = entity.type;
  327. return data;
  328. }
  329. extension UserMeDefaultUnitExtension on UserMeDefaultUnit {
  330. UserMeDefaultUnit copyWith({
  331. String? id,
  332. String? estateId,
  333. String? block,
  334. String? street,
  335. String? unit,
  336. String? address,
  337. int? type,
  338. }) {
  339. return UserMeDefaultUnit()
  340. ..id = id ?? this.id
  341. ..estateId = estateId ?? this.estateId
  342. ..block = block ?? this.block
  343. ..street = street ?? this.street
  344. ..unit = unit ?? this.unit
  345. ..address = address ?? this.address
  346. ..type = type ?? this.type;
  347. }
  348. }
  349. UserMeInformation $UserMeInformationFromJson(Map<String, dynamic> json) {
  350. final UserMeInformation userMeInformation = UserMeInformation();
  351. final String? firstName = jsonConvert.convert<String>(json['first_name']);
  352. if (firstName != null) {
  353. userMeInformation.firstName = firstName;
  354. }
  355. final String? lastName = jsonConvert.convert<String>(json['last_name']);
  356. if (lastName != null) {
  357. userMeInformation.lastName = lastName;
  358. }
  359. final String? countryCode = jsonConvert.convert<String>(json['country_code']);
  360. if (countryCode != null) {
  361. userMeInformation.countryCode = countryCode;
  362. }
  363. final String? phone = jsonConvert.convert<String>(json['phone']);
  364. if (phone != null) {
  365. userMeInformation.phone = phone;
  366. }
  367. return userMeInformation;
  368. }
  369. Map<String, dynamic> $UserMeInformationToJson(UserMeInformation entity) {
  370. final Map<String, dynamic> data = <String, dynamic>{};
  371. data['first_name'] = entity.firstName;
  372. data['last_name'] = entity.lastName;
  373. data['country_code'] = entity.countryCode;
  374. data['phone'] = entity.phone;
  375. return data;
  376. }
  377. extension UserMeInformationExtension on UserMeInformation {
  378. UserMeInformation copyWith({
  379. String? firstName,
  380. String? lastName,
  381. String? countryCode,
  382. String? phone,
  383. }) {
  384. return UserMeInformation()
  385. ..firstName = firstName ?? this.firstName
  386. ..lastName = lastName ?? this.lastName
  387. ..countryCode = countryCode ?? this.countryCode
  388. ..phone = phone ?? this.phone;
  389. }
  390. }