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

FormListEntity $FormListEntityFromJson(Map<String, dynamic> json) {
  final FormListEntity formListEntity = FormListEntity();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    formListEntity.id = id;
  }
  final String? typeId = jsonConvert.convert<String>(json['online_form_type_id']);
  if (typeId != null) {
    formListEntity.typeId = typeId;
  }
  final String? icon = jsonConvert.convert<String>(json['icon']);
  if (icon != null) {
    formListEntity.icon = icon;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    formListEntity.name = name;
  }
  final double? price = jsonConvert.convert<double>(json['price']);
  if (price != null) {
    formListEntity.price = price;
  }
  final double? deposit = jsonConvert.convert<double>(json['deposit']);
  if (deposit != null) {
    formListEntity.deposit = deposit;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    formListEntity.description = description;
  }
  return formListEntity;
}

Map<String, dynamic> $FormListEntityToJson(FormListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['online_form_type_id'] = entity.typeId;
  data['icon'] = entity.icon;
  data['name'] = entity.name;
  data['price'] = entity.price;
  data['deposit'] = entity.deposit;
  data['description'] = entity.description;
  return data;
}

extension FormListEntityExtension on FormListEntity {
  FormListEntity copyWith({
    String? id,
    String? typeId,
    String? icon,
    String? name,
    double? price,
    double? deposit,
    String? description,
  }) {
    return FormListEntity()
      ..id = id ?? this.id
      ..typeId = typeId ?? this.typeId
      ..icon = icon ?? this.icon
      ..name = name ?? this.name
      ..price = price ?? this.price
      ..deposit = deposit ?? this.deposit
      ..description = description ?? this.description;
  }
}