form_detail_entity.g.dart 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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>(
  15. json['content']);
  16. if (content != null) {
  17. formDetailEntity.content = content;
  18. }
  19. final int? status = jsonConvert.convert<int>(json['status']);
  20. if (status != null) {
  21. formDetailEntity.status = status;
  22. }
  23. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  24. if (createdAt != null) {
  25. formDetailEntity.createdAt = createdAt;
  26. }
  27. final String? updateAt = jsonConvert.convert<String>(json['update_at']);
  28. if (updateAt != null) {
  29. formDetailEntity.updateAt = updateAt;
  30. }
  31. final FormOrder? order = jsonConvert.convert<FormOrder>(json['order']);
  32. if (order != null) {
  33. formDetailEntity.order = order;
  34. }
  35. return formDetailEntity;
  36. }
  37. Map<String, dynamic> $FormDetailEntityToJson(FormDetailEntity entity) {
  38. final Map<String, dynamic> data = <String, dynamic>{};
  39. data['id'] = entity.id;
  40. data['user_id'] = entity.userId;
  41. data['content'] = entity.content?.toJson();
  42. data['status'] = entity.status;
  43. data['created_at'] = entity.createdAt;
  44. data['update_at'] = entity.updateAt;
  45. data['order'] = entity.order?.toJson();
  46. return data;
  47. }
  48. extension FormDetailEntityExtension on FormDetailEntity {
  49. FormDetailEntity copyWith({
  50. String? id,
  51. String? userId,
  52. FormContentEntity? content,
  53. int? status,
  54. String? createdAt,
  55. String? updateAt,
  56. FormOrder? order,
  57. }) {
  58. return FormDetailEntity()
  59. ..id = id ?? this.id
  60. ..userId = userId ?? this.userId
  61. ..content = content ?? this.content
  62. ..status = status ?? this.status
  63. ..createdAt = createdAt ?? this.createdAt
  64. ..updateAt = updateAt ?? this.updateAt
  65. ..order = order ?? this.order;
  66. }
  67. }
  68. FormOrder $FormOrderFromJson(Map<String, dynamic> json) {
  69. final FormOrder formOrder = FormOrder();
  70. final String? id = jsonConvert.convert<String>(json['id']);
  71. if (id != null) {
  72. formOrder.id = id;
  73. }
  74. final String? totalAmount = jsonConvert.convert<String>(json['total_amount']);
  75. if (totalAmount != null) {
  76. formOrder.totalAmount = totalAmount;
  77. }
  78. final String? orderAmount = jsonConvert.convert<String>(json['order_amount']);
  79. if (orderAmount != null) {
  80. formOrder.orderAmount = orderAmount;
  81. }
  82. final String? depositAmount = jsonConvert.convert<String>(
  83. json['deposit_amount']);
  84. if (depositAmount != null) {
  85. formOrder.depositAmount = depositAmount;
  86. }
  87. final int? paymentStatus = jsonConvert.convert<int>(json['payment_status']);
  88. if (paymentStatus != null) {
  89. formOrder.paymentStatus = paymentStatus;
  90. }
  91. final int? refundStatus = jsonConvert.convert<int>(json['refund_status']);
  92. if (refundStatus != null) {
  93. formOrder.refundStatus = refundStatus;
  94. }
  95. final String? paidAt = jsonConvert.convert<String>(json['paid_at']);
  96. if (paidAt != null) {
  97. formOrder.paidAt = paidAt;
  98. }
  99. final String? refundedAt = jsonConvert.convert<String>(json['refunded_at']);
  100. if (refundedAt != null) {
  101. formOrder.refundedAt = refundedAt;
  102. }
  103. return formOrder;
  104. }
  105. Map<String, dynamic> $FormOrderToJson(FormOrder entity) {
  106. final Map<String, dynamic> data = <String, dynamic>{};
  107. data['id'] = entity.id;
  108. data['total_amount'] = entity.totalAmount;
  109. data['order_amount'] = entity.orderAmount;
  110. data['deposit_amount'] = entity.depositAmount;
  111. data['payment_status'] = entity.paymentStatus;
  112. data['refund_status'] = entity.refundStatus;
  113. data['paid_at'] = entity.paidAt;
  114. data['refunded_at'] = entity.refundedAt;
  115. return data;
  116. }
  117. extension FormOrderExtension on FormOrder {
  118. FormOrder copyWith({
  119. String? id,
  120. String? totalAmount,
  121. String? orderAmount,
  122. String? depositAmount,
  123. int? paymentStatus,
  124. int? refundStatus,
  125. String? paidAt,
  126. String? refundedAt,
  127. }) {
  128. return FormOrder()
  129. ..id = id ?? this.id
  130. ..totalAmount = totalAmount ?? this.totalAmount
  131. ..orderAmount = orderAmount ?? this.orderAmount
  132. ..depositAmount = depositAmount ?? this.depositAmount
  133. ..paymentStatus = paymentStatus ?? this.paymentStatus
  134. ..refundStatus = refundStatus ?? this.refundStatus
  135. ..paidAt = paidAt ?? this.paidAt
  136. ..refundedAt = refundedAt ?? this.refundedAt;
  137. }
  138. }