123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- import 'package:domain/generated/json/base/json_convert_content.dart';
- import 'package:domain/entity/form_detail_entity.dart';
- import 'package:domain/entity/form_content_entity.dart';
- FormDetailEntity $FormDetailEntityFromJson(Map<String, dynamic> json) {
- final FormDetailEntity formDetailEntity = FormDetailEntity();
- final String? id = jsonConvert.convert<String>(json['id']);
- if (id != null) {
- formDetailEntity.id = id;
- }
- final String? userId = jsonConvert.convert<String>(json['user_id']);
- if (userId != null) {
- formDetailEntity.userId = userId;
- }
- final FormContentEntity? content = jsonConvert.convert<FormContentEntity>(json['content']);
- if (content != null) {
- formDetailEntity.content = content;
- }
- final int? status = jsonConvert.convert<int>(json['status']);
- if (status != null) {
- formDetailEntity.status = status;
- }
- final String? createdAt = jsonConvert.convert<String>(json['created_at']);
- if (createdAt != null) {
- formDetailEntity.createdAt = createdAt;
- }
- final String? updateAt = jsonConvert.convert<String>(json['updated_at']);
- if (updateAt != null) {
- formDetailEntity.updateAt = updateAt;
- }
- final FormOrder? order = jsonConvert.convert<FormOrder>(json['order']);
- if (order != null) {
- formDetailEntity.order = order;
- }
- return formDetailEntity;
- }
- Map<String, dynamic> $FormDetailEntityToJson(FormDetailEntity entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['user_id'] = entity.userId;
- data['content'] = entity.content?.toJson();
- data['status'] = entity.status;
- data['created_at'] = entity.createdAt;
- data['updated_at'] = entity.updateAt;
- data['order'] = entity.order?.toJson();
- return data;
- }
- extension FormDetailEntityExtension on FormDetailEntity {
- FormDetailEntity copyWith({
- String? id,
- String? userId,
- FormContentEntity? content,
- int? status,
- String? createdAt,
- String? updateAt,
- FormOrder? order,
- }) {
- return FormDetailEntity()
- ..id = id ?? this.id
- ..userId = userId ?? this.userId
- ..content = content ?? this.content
- ..status = status ?? this.status
- ..createdAt = createdAt ?? this.createdAt
- ..updateAt = updateAt ?? this.updateAt
- ..order = order ?? this.order;
- }
- }
- FormOrder $FormOrderFromJson(Map<String, dynamic> json) {
- final FormOrder formOrder = FormOrder();
- final String? id = jsonConvert.convert<String>(json['id']);
- if (id != null) {
- formOrder.id = id;
- }
- final String? totalAmount = jsonConvert.convert<String>(json['total_amount']);
- if (totalAmount != null) {
- formOrder.totalAmount = totalAmount;
- }
- final String? orderAmount = jsonConvert.convert<String>(json['order_amount']);
- if (orderAmount != null) {
- formOrder.orderAmount = orderAmount;
- }
- final String? depositAmount = jsonConvert.convert<String>(json['deposit_amount']);
- if (depositAmount != null) {
- formOrder.depositAmount = depositAmount;
- }
- final int? paymentStatus = jsonConvert.convert<int>(json['payment_status']);
- if (paymentStatus != null) {
- formOrder.paymentStatus = paymentStatus;
- }
- final int? refundStatus = jsonConvert.convert<int>(json['refund_status']);
- if (refundStatus != null) {
- formOrder.refundStatus = refundStatus;
- }
- final String? paidAt = jsonConvert.convert<String>(json['paid_at']);
- if (paidAt != null) {
- formOrder.paidAt = paidAt;
- }
- final String? refundedAt = jsonConvert.convert<String>(json['refunded_at']);
- if (refundedAt != null) {
- formOrder.refundedAt = refundedAt;
- }
- return formOrder;
- }
- Map<String, dynamic> $FormOrderToJson(FormOrder entity) {
- final Map<String, dynamic> data = <String, dynamic>{};
- data['id'] = entity.id;
- data['total_amount'] = entity.totalAmount;
- data['order_amount'] = entity.orderAmount;
- data['deposit_amount'] = entity.depositAmount;
- data['payment_status'] = entity.paymentStatus;
- data['refund_status'] = entity.refundStatus;
- data['paid_at'] = entity.paidAt;
- data['refunded_at'] = entity.refundedAt;
- return data;
- }
- extension FormOrderExtension on FormOrder {
- FormOrder copyWith({
- String? id,
- String? totalAmount,
- String? orderAmount,
- String? depositAmount,
- int? paymentStatus,
- int? refundStatus,
- String? paidAt,
- String? refundedAt,
- }) {
- return FormOrder()
- ..id = id ?? this.id
- ..totalAmount = totalAmount ?? this.totalAmount
- ..orderAmount = orderAmount ?? this.orderAmount
- ..depositAmount = depositAmount ?? this.depositAmount
- ..paymentStatus = paymentStatus ?? this.paymentStatus
- ..refundStatus = refundStatus ?? this.refundStatus
- ..paidAt = paidAt ?? this.paidAt
- ..refundedAt = refundedAt ?? this.refundedAt;
- }
- }
|