user_me_entity.g.dart 13 KB

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