switch_project_entity.g.dart 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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>?)
  7. ?.map(
  8. (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity)
  9. .toList();
  10. if (cutUser != null) {
  11. switchProjectEntity.cutUser = cutUser;
  12. }
  13. final List<SwitchProjectUserList>? userList = (json['user_list'] as List<
  14. dynamic>?)
  15. ?.map(
  16. (e) =>
  17. jsonConvert.convert<SwitchProjectUserList>(e) as SwitchProjectUserList)
  18. .toList();
  19. if (userList != null) {
  20. switchProjectEntity.userList = userList;
  21. }
  22. return switchProjectEntity;
  23. }
  24. Map<String, dynamic> $SwitchProjectEntityToJson(SwitchProjectEntity entity) {
  25. final Map<String, dynamic> data = <String, dynamic>{};
  26. data['cut_user'] = entity.cutUser?.map((v) => v.toJson()).toList();
  27. data['user_list'] = entity.userList?.map((v) => v.toJson()).toList();
  28. return data;
  29. }
  30. extension SwitchProjectEntityExtension on SwitchProjectEntity {
  31. SwitchProjectEntity copyWith({
  32. List<IndexOptionEntity>? cutUser,
  33. List<SwitchProjectUserList>? userList,
  34. }) {
  35. return SwitchProjectEntity()
  36. ..cutUser = cutUser ?? this.cutUser
  37. ..userList = userList ?? this.userList;
  38. }
  39. }
  40. SwitchProjectUserList $SwitchProjectUserListFromJson(
  41. Map<String, dynamic> json) {
  42. final SwitchProjectUserList switchProjectUserList = SwitchProjectUserList();
  43. final String? adminId = jsonConvert.convert<String>(json['admin_id']);
  44. if (adminId != null) {
  45. switchProjectUserList.adminId = adminId;
  46. }
  47. final String? adminName = jsonConvert.convert<String>(json['admin_name']);
  48. if (adminName != null) {
  49. switchProjectUserList.adminName = adminName;
  50. }
  51. final String? employerName = jsonConvert.convert<String>(
  52. json['employer_name']);
  53. if (employerName != null) {
  54. switchProjectUserList.employerName = employerName;
  55. }
  56. return switchProjectUserList;
  57. }
  58. Map<String, dynamic> $SwitchProjectUserListToJson(
  59. SwitchProjectUserList entity) {
  60. final Map<String, dynamic> data = <String, dynamic>{};
  61. data['admin_id'] = entity.adminId;
  62. data['admin_name'] = entity.adminName;
  63. data['employer_name'] = entity.employerName;
  64. return data;
  65. }
  66. extension SwitchProjectUserListExtension on SwitchProjectUserList {
  67. SwitchProjectUserList copyWith({
  68. String? adminId,
  69. String? adminName,
  70. String? employerName,
  71. }) {
  72. return SwitchProjectUserList()
  73. ..adminId = adminId ?? this.adminId
  74. ..adminName = adminName ?? this.adminName
  75. ..employerName = employerName ?? this.employerName;
  76. }
  77. }