labour_request_index_entity.g.dart 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/response/labour_request_index_entity.dart';
  3. import 'package:domain/entity/response/index_option_entity.dart';
  4. LabourRequestIndexEntity $LabourRequestIndexEntityFromJson(Map<String, dynamic> json) {
  5. final LabourRequestIndexEntity labourRequestIndexEntity = LabourRequestIndexEntity();
  6. final List<LabourRequestIndexDepartmentList>? departmentList = (json['department_list'] as List<dynamic>?)?.map(
  7. (e) => jsonConvert.convert<LabourRequestIndexDepartmentList>(e) as LabourRequestIndexDepartmentList).toList();
  8. if (departmentList != null) {
  9. labourRequestIndexEntity.departmentList = departmentList;
  10. }
  11. final List<LabourRequestIndexDepartmentList>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
  12. (e) => jsonConvert.convert<LabourRequestIndexDepartmentList>(e) as LabourRequestIndexDepartmentList).toList();
  13. if (outletList != null) {
  14. labourRequestIndexEntity.outletList = outletList;
  15. }
  16. final List<LabourRequestIndexStatusList>? statusList = (json['status_list'] as List<dynamic>?)?.map(
  17. (e) => jsonConvert.convert<LabourRequestIndexStatusList>(e) as LabourRequestIndexStatusList).toList();
  18. if (statusList != null) {
  19. labourRequestIndexEntity.statusList = statusList;
  20. }
  21. final List<IndexOptionEntity>? divisionList = (json['division_list'] as List<dynamic>?)?.map(
  22. (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  23. if (divisionList != null) {
  24. labourRequestIndexEntity.divisionList = divisionList;
  25. }
  26. return labourRequestIndexEntity;
  27. }
  28. Map<String, dynamic> $LabourRequestIndexEntityToJson(LabourRequestIndexEntity entity) {
  29. final Map<String, dynamic> data = <String, dynamic>{};
  30. data['department_list'] = entity.departmentList?.map((v) => v.toJson()).toList();
  31. data['outlet_list'] = entity.outletList?.map((v) => v.toJson()).toList();
  32. data['status_list'] = entity.statusList?.map((v) => v.toJson()).toList();
  33. data['division_list'] = entity.divisionList.map((v) => v.toJson()).toList();
  34. return data;
  35. }
  36. extension LabourRequestIndexEntityExtension on LabourRequestIndexEntity {
  37. LabourRequestIndexEntity copyWith({
  38. List<LabourRequestIndexDepartmentList>? departmentList,
  39. List<LabourRequestIndexDepartmentList>? outletList,
  40. List<LabourRequestIndexStatusList>? statusList,
  41. List<IndexOptionEntity>? divisionList,
  42. }) {
  43. return LabourRequestIndexEntity()
  44. ..departmentList = departmentList ?? this.departmentList
  45. ..outletList = outletList ?? this.outletList
  46. ..statusList = statusList ?? this.statusList
  47. ..divisionList = divisionList ?? this.divisionList;
  48. }
  49. }
  50. LabourRequestIndexDepartmentList $LabourRequestIndexDepartmentListFromJson(Map<String, dynamic> json) {
  51. final LabourRequestIndexDepartmentList labourRequestIndexDepartmentList = LabourRequestIndexDepartmentList();
  52. final String? value = jsonConvert.convert<String>(json['value']);
  53. if (value != null) {
  54. labourRequestIndexDepartmentList.value = value;
  55. }
  56. final String? txt = jsonConvert.convert<String>(json['txt']);
  57. if (txt != null) {
  58. labourRequestIndexDepartmentList.txt = txt;
  59. }
  60. final String? selected = jsonConvert.convert<String>(json['selected']);
  61. if (selected != null) {
  62. labourRequestIndexDepartmentList.selected = selected;
  63. }
  64. return labourRequestIndexDepartmentList;
  65. }
  66. Map<String, dynamic> $LabourRequestIndexDepartmentListToJson(LabourRequestIndexDepartmentList entity) {
  67. final Map<String, dynamic> data = <String, dynamic>{};
  68. data['value'] = entity.value;
  69. data['txt'] = entity.txt;
  70. data['selected'] = entity.selected;
  71. return data;
  72. }
  73. extension LabourRequestIndexDepartmentListExtension on LabourRequestIndexDepartmentList {
  74. LabourRequestIndexDepartmentList copyWith({
  75. String? value,
  76. String? txt,
  77. String? selected,
  78. }) {
  79. return LabourRequestIndexDepartmentList()
  80. ..value = value ?? this.value
  81. ..txt = txt ?? this.txt
  82. ..selected = selected ?? this.selected;
  83. }
  84. }
  85. LabourRequestIndexStatusList $LabourRequestIndexStatusListFromJson(Map<String, dynamic> json) {
  86. final LabourRequestIndexStatusList labourRequestIndexStatusList = LabourRequestIndexStatusList();
  87. final String? value = jsonConvert.convert<String>(json['value']);
  88. if (value != null) {
  89. labourRequestIndexStatusList.value = value;
  90. }
  91. final String? txt = jsonConvert.convert<String>(json['txt']);
  92. if (txt != null) {
  93. labourRequestIndexStatusList.txt = txt;
  94. }
  95. final String? selected = jsonConvert.convert<String>(json['selected']);
  96. if (selected != null) {
  97. labourRequestIndexStatusList.selected = selected;
  98. }
  99. return labourRequestIndexStatusList;
  100. }
  101. Map<String, dynamic> $LabourRequestIndexStatusListToJson(LabourRequestIndexStatusList entity) {
  102. final Map<String, dynamic> data = <String, dynamic>{};
  103. data['value'] = entity.value;
  104. data['txt'] = entity.txt;
  105. data['selected'] = entity.selected;
  106. return data;
  107. }
  108. extension LabourRequestIndexStatusListExtension on LabourRequestIndexStatusList {
  109. LabourRequestIndexStatusList copyWith({
  110. String? value,
  111. String? txt,
  112. String? selected,
  113. }) {
  114. return LabourRequestIndexStatusList()
  115. ..value = value ?? this.value
  116. ..txt = txt ?? this.txt
  117. ..selected = selected ?? this.selected;
  118. }
  119. }