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? sentOn = jsonConvert.convert<String>(json['sent_on']);
  if (sentOn != null) {
    formDetailEntity.sentOn = sentOn;
  }
  final String? rejectedOn = jsonConvert.convert<String>(json['rejected_on']);
  if (rejectedOn != null) {
    formDetailEntity.rejectedOn = rejectedOn;
  }
  final String? approvedOn = jsonConvert.convert<String>(json['approved_on']);
  if (approvedOn != null) {
    formDetailEntity.approvedOn = approvedOn;
  }
  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['sent_on'] = entity.sentOn;
  data['rejected_on'] = entity.rejectedOn;
  data['approved_on'] = entity.approvedOn;
  return data;
}

extension FormDetailEntityExtension on FormDetailEntity {
  FormDetailEntity copyWith({
    String? id,
    String? userId,
    FormContentEntity? content,
    int? status,
    String? sentOn,
    String? rejectedOn,
    String? approvedOn,
  }) {
    return FormDetailEntity()
      ..id = id ?? this.id
      ..userId = userId ?? this.userId
      ..content = content ?? this.content
      ..status = status ?? this.status
      ..sentOn = sentOn ?? this.sentOn
      ..rejectedOn = rejectedOn ?? this.rejectedOn
      ..approvedOn = approvedOn ?? this.approvedOn;
  }
}