form_detail_entity.g.dart 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. import 'package:domain/generated/json/base/json_convert_content.dart';
  2. import 'package:domain/entity/form_detail_entity.dart';
  3. import 'package:domain/entity/form_content_entity.dart';
  4. FormDetailEntity $FormDetailEntityFromJson(Map<String, dynamic> json) {
  5. final FormDetailEntity formDetailEntity = FormDetailEntity();
  6. final String? id = jsonConvert.convert<String>(json['id']);
  7. if (id != null) {
  8. formDetailEntity.id = id;
  9. }
  10. final String? userId = jsonConvert.convert<String>(json['user_id']);
  11. if (userId != null) {
  12. formDetailEntity.userId = userId;
  13. }
  14. final FormContentEntity? content = jsonConvert.convert<FormContentEntity>(json['content']);
  15. if (content != null) {
  16. formDetailEntity.content = content;
  17. }
  18. final int? status = jsonConvert.convert<int>(json['status']);
  19. if (status != null) {
  20. formDetailEntity.status = status;
  21. }
  22. final String? sentOn = jsonConvert.convert<String>(json['sent_on']);
  23. if (sentOn != null) {
  24. formDetailEntity.sentOn = sentOn;
  25. }
  26. final String? rejectedOn = jsonConvert.convert<String>(json['rejected_on']);
  27. if (rejectedOn != null) {
  28. formDetailEntity.rejectedOn = rejectedOn;
  29. }
  30. final String? approvedOn = jsonConvert.convert<String>(json['approved_on']);
  31. if (approvedOn != null) {
  32. formDetailEntity.approvedOn = approvedOn;
  33. }
  34. final FormOrder? order = jsonConvert.convert<FormOrder>(json['order']);
  35. if (order != null) {
  36. formDetailEntity.order = order;
  37. }
  38. return formDetailEntity;
  39. }
  40. Map<String, dynamic> $FormDetailEntityToJson(FormDetailEntity entity) {
  41. final Map<String, dynamic> data = <String, dynamic>{};
  42. data['id'] = entity.id;
  43. data['user_id'] = entity.userId;
  44. data['content'] = entity.content?.toJson();
  45. data['status'] = entity.status;
  46. data['sent_on'] = entity.sentOn;
  47. data['rejected_on'] = entity.rejectedOn;
  48. data['approved_on'] = entity.approvedOn;
  49. data['order'] = entity.order?.toJson();
  50. return data;
  51. }
  52. extension FormDetailEntityExtension on FormDetailEntity {
  53. FormDetailEntity copyWith({
  54. String? id,
  55. String? userId,
  56. FormContentEntity? content,
  57. int? status,
  58. String? sentOn,
  59. String? rejectedOn,
  60. String? approvedOn,
  61. FormOrder? order,
  62. }) {
  63. return FormDetailEntity()
  64. ..id = id ?? this.id
  65. ..userId = userId ?? this.userId
  66. ..content = content ?? this.content
  67. ..status = status ?? this.status
  68. ..sentOn = sentOn ?? this.sentOn
  69. ..rejectedOn = rejectedOn ?? this.rejectedOn
  70. ..approvedOn = approvedOn ?? this.approvedOn
  71. ..order = order ?? this.order;
  72. }
  73. }
  74. FormOrder $FormOrderFromJson(Map<String, dynamic> json) {
  75. final FormOrder formOrder = FormOrder();
  76. final String? id = jsonConvert.convert<String>(json['id']);
  77. if (id != null) {
  78. formOrder.id = id;
  79. }
  80. final String? totalAmount = jsonConvert.convert<String>(json['total_amount']);
  81. if (totalAmount != null) {
  82. formOrder.totalAmount = totalAmount;
  83. }
  84. final String? orderAmount = jsonConvert.convert<String>(json['order_amount']);
  85. if (orderAmount != null) {
  86. formOrder.orderAmount = orderAmount;
  87. }
  88. final String? depositAmount = jsonConvert.convert<String>(json['deposit_amount']);
  89. if (depositAmount != null) {
  90. formOrder.depositAmount = depositAmount;
  91. }
  92. final int? paymentStatus = jsonConvert.convert<int>(json['payment_status']);
  93. if (paymentStatus != null) {
  94. formOrder.paymentStatus = paymentStatus;
  95. }
  96. final int? refundStatus = jsonConvert.convert<int>(json['refund_status']);
  97. if (refundStatus != null) {
  98. formOrder.refundStatus = refundStatus;
  99. }
  100. return formOrder;
  101. }
  102. Map<String, dynamic> $FormOrderToJson(FormOrder entity) {
  103. final Map<String, dynamic> data = <String, dynamic>{};
  104. data['id'] = entity.id;
  105. data['total_amount'] = entity.totalAmount;
  106. data['order_amount'] = entity.orderAmount;
  107. data['deposit_amount'] = entity.depositAmount;
  108. data['payment_status'] = entity.paymentStatus;
  109. data['refund_status'] = entity.refundStatus;
  110. return data;
  111. }
  112. extension FormOrderExtension on FormOrder {
  113. FormOrder copyWith({
  114. String? id,
  115. String? totalAmount,
  116. String? orderAmount,
  117. String? depositAmount,
  118. int? paymentStatus,
  119. int? refundStatus,
  120. }) {
  121. return FormOrder()
  122. ..id = id ?? this.id
  123. ..totalAmount = totalAmount ?? this.totalAmount
  124. ..orderAmount = orderAmount ?? this.orderAmount
  125. ..depositAmount = depositAmount ?? this.depositAmount
  126. ..paymentStatus = paymentStatus ?? this.paymentStatus
  127. ..refundStatus = refundStatus ?? this.refundStatus;
  128. }
  129. }