labour_request_index_entity.g.dart 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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(
  5. Map<String, dynamic> json) {
  6. final LabourRequestIndexEntity labourRequestIndexEntity = LabourRequestIndexEntity();
  7. final List<
  8. LabourRequestIndexDepartmentList>? departmentList = (json['department_list'] as List<
  9. dynamic>?)?.map(
  10. (e) =>
  11. jsonConvert.convert<LabourRequestIndexDepartmentList>(
  12. e) as LabourRequestIndexDepartmentList).toList();
  13. if (departmentList != null) {
  14. labourRequestIndexEntity.departmentList = departmentList;
  15. }
  16. final List<
  17. LabourRequestIndexDepartmentList>? outletList = (json['outlet_list'] as List<
  18. dynamic>?)?.map(
  19. (e) =>
  20. jsonConvert.convert<LabourRequestIndexDepartmentList>(
  21. e) as LabourRequestIndexDepartmentList).toList();
  22. if (outletList != null) {
  23. labourRequestIndexEntity.outletList = outletList;
  24. }
  25. final List<
  26. LabourRequestIndexStatusList>? statusList = (json['status_list'] as List<
  27. dynamic>?)?.map(
  28. (e) =>
  29. jsonConvert.convert<LabourRequestIndexStatusList>(
  30. e) as LabourRequestIndexStatusList).toList();
  31. if (statusList != null) {
  32. labourRequestIndexEntity.statusList = statusList;
  33. }
  34. final List<IndexOptionEntity>? divisionList = (json['division_list'] as List<
  35. dynamic>?)
  36. ?.map(
  37. (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity)
  38. .toList();
  39. if (divisionList != null) {
  40. labourRequestIndexEntity.divisionList = divisionList;
  41. }
  42. return labourRequestIndexEntity;
  43. }
  44. Map<String, dynamic> $LabourRequestIndexEntityToJson(
  45. LabourRequestIndexEntity entity) {
  46. final Map<String, dynamic> data = <String, dynamic>{};
  47. data['department_list'] =
  48. entity.departmentList?.map((v) => v.toJson()).toList();
  49. data['outlet_list'] = entity.outletList?.map((v) => v.toJson()).toList();
  50. data['status_list'] = entity.statusList?.map((v) => v.toJson()).toList();
  51. data['division_list'] = entity.divisionList.map((v) => v.toJson()).toList();
  52. return data;
  53. }
  54. extension LabourRequestIndexEntityExtension on LabourRequestIndexEntity {
  55. LabourRequestIndexEntity copyWith({
  56. List<LabourRequestIndexDepartmentList>? departmentList,
  57. List<LabourRequestIndexDepartmentList>? outletList,
  58. List<LabourRequestIndexStatusList>? statusList,
  59. List<IndexOptionEntity>? divisionList,
  60. }) {
  61. return LabourRequestIndexEntity()
  62. ..departmentList = departmentList ?? this.departmentList
  63. ..outletList = outletList ?? this.outletList
  64. ..statusList = statusList ?? this.statusList
  65. ..divisionList = divisionList ?? this.divisionList;
  66. }
  67. }
  68. LabourRequestIndexDepartmentList $LabourRequestIndexDepartmentListFromJson(
  69. Map<String, dynamic> json) {
  70. final LabourRequestIndexDepartmentList labourRequestIndexDepartmentList = LabourRequestIndexDepartmentList();
  71. final String? value = jsonConvert.convert<String>(json['value']);
  72. if (value != null) {
  73. labourRequestIndexDepartmentList.value = value;
  74. }
  75. final String? txt = jsonConvert.convert<String>(json['txt']);
  76. if (txt != null) {
  77. labourRequestIndexDepartmentList.txt = txt;
  78. }
  79. final String? selected = jsonConvert.convert<String>(json['selected']);
  80. if (selected != null) {
  81. labourRequestIndexDepartmentList.selected = selected;
  82. }
  83. return labourRequestIndexDepartmentList;
  84. }
  85. Map<String, dynamic> $LabourRequestIndexDepartmentListToJson(
  86. LabourRequestIndexDepartmentList entity) {
  87. final Map<String, dynamic> data = <String, dynamic>{};
  88. data['value'] = entity.value;
  89. data['txt'] = entity.txt;
  90. data['selected'] = entity.selected;
  91. return data;
  92. }
  93. extension LabourRequestIndexDepartmentListExtension on LabourRequestIndexDepartmentList {
  94. LabourRequestIndexDepartmentList copyWith({
  95. String? value,
  96. String? txt,
  97. String? selected,
  98. }) {
  99. return LabourRequestIndexDepartmentList()
  100. ..value = value ?? this.value
  101. ..txt = txt ?? this.txt
  102. ..selected = selected ?? this.selected;
  103. }
  104. }
  105. LabourRequestIndexStatusList $LabourRequestIndexStatusListFromJson(
  106. Map<String, dynamic> json) {
  107. final LabourRequestIndexStatusList labourRequestIndexStatusList = LabourRequestIndexStatusList();
  108. final String? value = jsonConvert.convert<String>(json['value']);
  109. if (value != null) {
  110. labourRequestIndexStatusList.value = value;
  111. }
  112. final String? txt = jsonConvert.convert<String>(json['txt']);
  113. if (txt != null) {
  114. labourRequestIndexStatusList.txt = txt;
  115. }
  116. final String? selected = jsonConvert.convert<String>(json['selected']);
  117. if (selected != null) {
  118. labourRequestIndexStatusList.selected = selected;
  119. }
  120. return labourRequestIndexStatusList;
  121. }
  122. Map<String, dynamic> $LabourRequestIndexStatusListToJson(
  123. LabourRequestIndexStatusList entity) {
  124. final Map<String, dynamic> data = <String, dynamic>{};
  125. data['value'] = entity.value;
  126. data['txt'] = entity.txt;
  127. data['selected'] = entity.selected;
  128. return data;
  129. }
  130. extension LabourRequestIndexStatusListExtension on LabourRequestIndexStatusList {
  131. LabourRequestIndexStatusList copyWith({
  132. String? value,
  133. String? txt,
  134. String? selected,
  135. }) {
  136. return LabourRequestIndexStatusList()
  137. ..value = value ?? this.value
  138. ..txt = txt ?? this.txt
  139. ..selected = selected ?? this.selected;
  140. }
  141. }