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

JoinEstateSuccessEntity $JoinEstateSuccessEntityFromJson(Map<String, dynamic> json) {
  final JoinEstateSuccessEntity joinEstateSuccessEntity = JoinEstateSuccessEntity();
  final String? sn = jsonConvert.convert<String>(json['sn']);
  if (sn != null) {
    joinEstateSuccessEntity.sn = sn;
  }
  final String? userId = jsonConvert.convert<String>(json['user_id']);
  if (userId != null) {
    joinEstateSuccessEntity.userId = userId;
  }
  final String? stateId = jsonConvert.convert<String>(json['state_id']);
  if (stateId != null) {
    joinEstateSuccessEntity.stateId = stateId;
  }
  final String? type = jsonConvert.convert<String>(json['type']);
  if (type != null) {
    joinEstateSuccessEntity.type = type;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    joinEstateSuccessEntity.status = status;
  }
  final List<String>? files = (json['files'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (files != null) {
    joinEstateSuccessEntity.files = files;
  }
  final String? updatedAt = jsonConvert.convert<String>(json['updated_at']);
  if (updatedAt != null) {
    joinEstateSuccessEntity.updatedAt = updatedAt;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    joinEstateSuccessEntity.createdAt = createdAt;
  }
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    joinEstateSuccessEntity.id = id;
  }
  final JoinEstateSuccessEstate? estate = jsonConvert.convert<JoinEstateSuccessEstate>(json['estate']);
  if (estate != null) {
    joinEstateSuccessEntity.estate = estate;
  }
  return joinEstateSuccessEntity;
}

Map<String, dynamic> $JoinEstateSuccessEntityToJson(JoinEstateSuccessEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['sn'] = entity.sn;
  data['user_id'] = entity.userId;
  data['state_id'] = entity.stateId;
  data['type'] = entity.type;
  data['status'] = entity.status;
  data['files'] = entity.files;
  data['updated_at'] = entity.updatedAt;
  data['created_at'] = entity.createdAt;
  data['id'] = entity.id;
  data['estate'] = entity.estate?.toJson();
  return data;
}

extension JoinEstateSuccessEntityExtension on JoinEstateSuccessEntity {
  JoinEstateSuccessEntity copyWith({
    String? sn,
    String? userId,
    String? stateId,
    String? type,
    int? status,
    List<String>? files,
    String? updatedAt,
    String? createdAt,
    String? id,
    JoinEstateSuccessEstate? estate,
  }) {
    return JoinEstateSuccessEntity()
      ..sn = sn ?? this.sn
      ..userId = userId ?? this.userId
      ..stateId = stateId ?? this.stateId
      ..type = type ?? this.type
      ..status = status ?? this.status
      ..files = files ?? this.files
      ..updatedAt = updatedAt ?? this.updatedAt
      ..createdAt = createdAt ?? this.createdAt
      ..id = id ?? this.id
      ..estate = estate ?? this.estate;
  }
}

JoinEstateSuccessEstate $JoinEstateSuccessEstateFromJson(Map<String, dynamic> json) {
  final JoinEstateSuccessEstate joinEstateSuccessEstate = JoinEstateSuccessEstate();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    joinEstateSuccessEstate.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    joinEstateSuccessEstate.name = name;
  }
  final JoinEstateSuccessEstateInformation? information = jsonConvert.convert<JoinEstateSuccessEstateInformation>(json['information']);
  if (information != null) {
    joinEstateSuccessEstate.information = information;
  }
  return joinEstateSuccessEstate;
}

Map<String, dynamic> $JoinEstateSuccessEstateToJson(JoinEstateSuccessEstate entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['information'] = entity.information?.toJson();
  return data;
}

extension JoinEstateSuccessEstateExtension on JoinEstateSuccessEstate {
  JoinEstateSuccessEstate copyWith({
    String? id,
    String? name,
    JoinEstateSuccessEstateInformation? information,
  }) {
    return JoinEstateSuccessEstate()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..information = information ?? this.information;
  }
}

JoinEstateSuccessEstateInformation $JoinEstateSuccessEstateInformationFromJson(Map<String, dynamic> json) {
  final JoinEstateSuccessEstateInformation joinEstateSuccessEstateInformation = JoinEstateSuccessEstateInformation();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    joinEstateSuccessEstateInformation.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    joinEstateSuccessEstateInformation.name = name;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    joinEstateSuccessEstateInformation.email = email;
  }
  final String? address = jsonConvert.convert<String>(json['address']);
  if (address != null) {
    joinEstateSuccessEstateInformation.address = address;
  }
  final String? contactNumber = jsonConvert.convert<String>(json['contact_number']);
  if (contactNumber != null) {
    joinEstateSuccessEstateInformation.contactNumber = contactNumber;
  }
  return joinEstateSuccessEstateInformation;
}

Map<String, dynamic> $JoinEstateSuccessEstateInformationToJson(JoinEstateSuccessEstateInformation entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['email'] = entity.email;
  data['address'] = entity.address;
  data['contact_number'] = entity.contactNumber;
  return data;
}

extension JoinEstateSuccessEstateInformationExtension on JoinEstateSuccessEstateInformation {
  JoinEstateSuccessEstateInformation copyWith({
    String? id,
    String? name,
    String? email,
    String? address,
    String? contactNumber,
  }) {
    return JoinEstateSuccessEstateInformation()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..email = email ?? this.email
      ..address = address ?? this.address
      ..contactNumber = contactNumber ?? this.contactNumber;
  }
}