form_detail_entity.g.dart 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 String? description = jsonConvert.convert<String>(json['description']);
  15. if (description != null) {
  16. formDetailEntity.description = description;
  17. }
  18. final FormContentEntity? content = jsonConvert.convert<FormContentEntity>(json['content']);
  19. if (content != null) {
  20. formDetailEntity.content = content;
  21. }
  22. final int? status = jsonConvert.convert<int>(json['status']);
  23. if (status != null) {
  24. formDetailEntity.status = status;
  25. }
  26. final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  27. if (createdAt != null) {
  28. formDetailEntity.createdAt = createdAt;
  29. }
  30. final String? updateAt = jsonConvert.convert<String>(json['updated_at']);
  31. if (updateAt != null) {
  32. formDetailEntity.updateAt = updateAt;
  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['description'] = entity.description;
  45. data['content'] = entity.content?.toJson();
  46. data['status'] = entity.status;
  47. data['created_at'] = entity.createdAt;
  48. data['updated_at'] = entity.updateAt;
  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. String? description,
  57. FormContentEntity? content,
  58. int? status,
  59. String? createdAt,
  60. String? updateAt,
  61. FormOrder? order,
  62. }) {
  63. return FormDetailEntity()
  64. ..id = id ?? this.id
  65. ..userId = userId ?? this.userId
  66. ..description = description ?? this.description
  67. ..content = content ?? this.content
  68. ..status = status ?? this.status
  69. ..createdAt = createdAt ?? this.createdAt
  70. ..updateAt = updateAt ?? this.updateAt
  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. final String? paidAt = jsonConvert.convert<String>(json['paid_at']);
  101. if (paidAt != null) {
  102. formOrder.paidAt = paidAt;
  103. }
  104. final String? refundedAt = jsonConvert.convert<String>(json['refunded_at']);
  105. if (refundedAt != null) {
  106. formOrder.refundedAt = refundedAt;
  107. }
  108. return formOrder;
  109. }
  110. Map<String, dynamic> $FormOrderToJson(FormOrder entity) {
  111. final Map<String, dynamic> data = <String, dynamic>{};
  112. data['id'] = entity.id;
  113. data['total_amount'] = entity.totalAmount;
  114. data['order_amount'] = entity.orderAmount;
  115. data['deposit_amount'] = entity.depositAmount;
  116. data['payment_status'] = entity.paymentStatus;
  117. data['refund_status'] = entity.refundStatus;
  118. data['paid_at'] = entity.paidAt;
  119. data['refunded_at'] = entity.refundedAt;
  120. return data;
  121. }
  122. extension FormOrderExtension on FormOrder {
  123. FormOrder copyWith({
  124. String? id,
  125. String? totalAmount,
  126. String? orderAmount,
  127. String? depositAmount,
  128. int? paymentStatus,
  129. int? refundStatus,
  130. String? paidAt,
  131. String? refundedAt,
  132. }) {
  133. return FormOrder()
  134. ..id = id ?? this.id
  135. ..totalAmount = totalAmount ?? this.totalAmount
  136. ..orderAmount = orderAmount ?? this.orderAmount
  137. ..depositAmount = depositAmount ?? this.depositAmount
  138. ..paymentStatus = paymentStatus ?? this.paymentStatus
  139. ..refundStatus = refundStatus ?? this.refundStatus
  140. ..paidAt = paidAt ?? this.paidAt
  141. ..refundedAt = refundedAt ?? this.refundedAt;
  142. }
  143. }