switch_project_entity.g.dart 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/response/switch_project_entity.dart';
  3. import 'package:domain/entity/response/index_option_entity.dart';
  4. SwitchProjectEntity $SwitchProjectEntityFromJson(Map<String, dynamic> json) {
  5. final SwitchProjectEntity switchProjectEntity = SwitchProjectEntity();
  6. final List<IndexOptionEntity>? cutUser = (json['cut_user'] as List<dynamic>?)?.map(
  7. (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  8. if (cutUser != null) {
  9. switchProjectEntity.cutUser = cutUser;
  10. }
  11. final List<SwitchProjectUserList>? userList = (json['user_list'] as List<dynamic>?)?.map(
  12. (e) => jsonConvert.convert<SwitchProjectUserList>(e) as SwitchProjectUserList).toList();
  13. if (userList != null) {
  14. switchProjectEntity.userList = userList;
  15. }
  16. return switchProjectEntity;
  17. }
  18. Map<String, dynamic> $SwitchProjectEntityToJson(SwitchProjectEntity entity) {
  19. final Map<String, dynamic> data = <String, dynamic>{};
  20. data['cut_user'] = entity.cutUser?.map((v) => v.toJson()).toList();
  21. data['user_list'] = entity.userList?.map((v) => v.toJson()).toList();
  22. return data;
  23. }
  24. extension SwitchProjectEntityExtension on SwitchProjectEntity {
  25. SwitchProjectEntity copyWith({
  26. List<IndexOptionEntity>? cutUser,
  27. List<SwitchProjectUserList>? userList,
  28. }) {
  29. return SwitchProjectEntity()
  30. ..cutUser = cutUser ?? this.cutUser
  31. ..userList = userList ?? this.userList;
  32. }
  33. }
  34. SwitchProjectUserList $SwitchProjectUserListFromJson(Map<String, dynamic> json) {
  35. final SwitchProjectUserList switchProjectUserList = SwitchProjectUserList();
  36. final String? adminId = jsonConvert.convert<String>(json['admin_id']);
  37. if (adminId != null) {
  38. switchProjectUserList.adminId = adminId;
  39. }
  40. final String? adminName = jsonConvert.convert<String>(json['admin_name']);
  41. if (adminName != null) {
  42. switchProjectUserList.adminName = adminName;
  43. }
  44. final String? employerName = jsonConvert.convert<String>(json['employer_name']);
  45. if (employerName != null) {
  46. switchProjectUserList.employerName = employerName;
  47. }
  48. return switchProjectUserList;
  49. }
  50. Map<String, dynamic> $SwitchProjectUserListToJson(SwitchProjectUserList entity) {
  51. final Map<String, dynamic> data = <String, dynamic>{};
  52. data['admin_id'] = entity.adminId;
  53. data['admin_name'] = entity.adminName;
  54. data['employer_name'] = entity.employerName;
  55. return data;
  56. }
  57. extension SwitchProjectUserListExtension on SwitchProjectUserList {
  58. SwitchProjectUserList copyWith({
  59. String? adminId,
  60. String? adminName,
  61. String? employerName,
  62. }) {
  63. return SwitchProjectUserList()
  64. ..adminId = adminId ?? this.adminId
  65. ..adminName = adminName ?? this.adminName
  66. ..employerName = employerName ?? this.employerName;
  67. }
  68. }