import 'package:domain/generated/json/base/json_convert_content.dart';
import 'package:domain/entity/form_submitted_entity.dart';
import 'package:domain/entity/id_name_entity.dart';


FormSubmittedEntity $FormSubmittedEntityFromJson(Map<String, dynamic> json) {
  final FormSubmittedEntity formSubmittedEntity = FormSubmittedEntity();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    formSubmittedEntity.id = id;
  }
  final String? userId = jsonConvert.convert<String>(json['user_id']);
  if (userId != null) {
    formSubmittedEntity.userId = userId;
  }
  final String? estateOnlineFormId = jsonConvert.convert<String>(json['estate_online_form_id']);
  if (estateOnlineFormId != null) {
    formSubmittedEntity.estateOnlineFormId = estateOnlineFormId;
  }
  final String? sentOn = jsonConvert.convert<String>(json['sent_on']);
  if (sentOn != null) {
    formSubmittedEntity.sentOn = sentOn;
  }
  final String? rejectedOn = jsonConvert.convert<String>(json['rejected_on']);
  if (rejectedOn != null) {
    formSubmittedEntity.rejectedOn = rejectedOn;
  }
  final String? approvedOn = jsonConvert.convert<String>(json['approved_on']);
  if (approvedOn != null) {
    formSubmittedEntity.approvedOn = approvedOn;
  }
  final FormSubmittedEstateOnlineForm? estateOnlineForm = jsonConvert.convert<FormSubmittedEstateOnlineForm>(json['estate_online_form']);
  if (estateOnlineForm != null) {
    formSubmittedEntity.estateOnlineForm = estateOnlineForm;
  }
  final IdNameEntity? account = jsonConvert.convert<IdNameEntity>(json['account']);
  if (account != null) {
    formSubmittedEntity.account = account;
  }
  final FormSubmittedOrder? order = jsonConvert.convert<FormSubmittedOrder>(json['order']);
  if (order != null) {
    formSubmittedEntity.order = order;
  }
  return formSubmittedEntity;
}

Map<String, dynamic> $FormSubmittedEntityToJson(FormSubmittedEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['user_id'] = entity.userId;
  data['estate_online_form_id'] = entity.estateOnlineFormId;
  data['sent_on'] = entity.sentOn;
  data['rejected_on'] = entity.rejectedOn;
  data['approved_on'] = entity.approvedOn;
  data['estate_online_form'] = entity.estateOnlineForm?.toJson();
  data['account'] = entity.account?.toJson();
  data['order'] = entity.order?.toJson();
  return data;
}

extension FormSubmittedEntityExtension on FormSubmittedEntity {
  FormSubmittedEntity copyWith({
    String? id,
    String? userId,
    String? estateOnlineFormId,
    String? sentOn,
    String? rejectedOn,
    String? approvedOn,
    FormSubmittedEstateOnlineForm? estateOnlineForm,
    IdNameEntity? account,
    FormSubmittedOrder? order,
  }) {
    return FormSubmittedEntity()
      ..id = id ?? this.id
      ..userId = userId ?? this.userId
      ..estateOnlineFormId = estateOnlineFormId ?? this.estateOnlineFormId
      ..sentOn = sentOn ?? this.sentOn
      ..rejectedOn = rejectedOn ?? this.rejectedOn
      ..approvedOn = approvedOn ?? this.approvedOn
      ..estateOnlineForm = estateOnlineForm ?? this.estateOnlineForm
      ..account = account ?? this.account
      ..order = order ?? this.order;
  }
}

FormSubmittedEstateOnlineForm $FormSubmittedEstateOnlineFormFromJson(Map<String, dynamic> json) {
  final FormSubmittedEstateOnlineForm formSubmittedEstateOnlineForm = FormSubmittedEstateOnlineForm();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    formSubmittedEstateOnlineForm.id = id;
  }
  final String? icon = jsonConvert.convert<String>(json['icon']);
  if (icon != null) {
    formSubmittedEstateOnlineForm.icon = icon;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    formSubmittedEstateOnlineForm.name = name;
  }
  final IdNameEntity? type = jsonConvert.convert<IdNameEntity>(json['type']);
  if (type != null) {
    formSubmittedEstateOnlineForm.type = type;
  }
  return formSubmittedEstateOnlineForm;
}

Map<String, dynamic> $FormSubmittedEstateOnlineFormToJson(FormSubmittedEstateOnlineForm entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['icon'] = entity.icon;
  data['name'] = entity.name;
  data['type'] = entity.type?.toJson();
  return data;
}

extension FormSubmittedEstateOnlineFormExtension on FormSubmittedEstateOnlineForm {
  FormSubmittedEstateOnlineForm copyWith({
    String? id,
    String? icon,
    String? name,
    IdNameEntity? type,
  }) {
    return FormSubmittedEstateOnlineForm()
      ..id = id ?? this.id
      ..icon = icon ?? this.icon
      ..name = name ?? this.name
      ..type = type ?? this.type;
  }
}

FormSubmittedOrder $FormSubmittedOrderFromJson(Map<String, dynamic> json) {
  final FormSubmittedOrder formSubmittedOrder = FormSubmittedOrder();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    formSubmittedOrder.id = id;
  }
  final String? totalAmount = jsonConvert.convert<String>(json['total_amount']);
  if (totalAmount != null) {
    formSubmittedOrder.totalAmount = totalAmount;
  }
  final String? orderAmount = jsonConvert.convert<String>(json['order_amount']);
  if (orderAmount != null) {
    formSubmittedOrder.orderAmount = orderAmount;
  }
  final String? depositAmount = jsonConvert.convert<String>(json['deposit_amount']);
  if (depositAmount != null) {
    formSubmittedOrder.depositAmount = depositAmount;
  }
  final int? paymentStatus = jsonConvert.convert<int>(json['payment_status']);
  if (paymentStatus != null) {
    formSubmittedOrder.paymentStatus = paymentStatus;
  }
  final int? refundStatus = jsonConvert.convert<int>(json['refund_status']);
  if (refundStatus != null) {
    formSubmittedOrder.refundStatus = refundStatus;
  }
  return formSubmittedOrder;
}

Map<String, dynamic> $FormSubmittedOrderToJson(FormSubmittedOrder 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;
  return data;
}

extension FormSubmittedOrderExtension on FormSubmittedOrder {
  FormSubmittedOrder copyWith({
    String? id,
    String? totalAmount,
    String? orderAmount,
    String? depositAmount,
    int? paymentStatus,
    int? refundStatus,
  }) {
    return FormSubmittedOrder()
      ..id = id ?? this.id
      ..totalAmount = totalAmount ?? this.totalAmount
      ..orderAmount = orderAmount ?? this.orderAmount
      ..depositAmount = depositAmount ?? this.depositAmount
      ..paymentStatus = paymentStatus ?? this.paymentStatus
      ..refundStatus = refundStatus ?? this.refundStatus;
  }
}