labour_request_index_entity.g.dart 5.7 KB

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