form_detail_entity.g.dart 4.7 KB

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