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

ServiceEvaluateListEntity $ServiceEvaluateListEntityFromJson(Map<String, dynamic> json) {
  final ServiceEvaluateListEntity serviceEvaluateListEntity = ServiceEvaluateListEntity();
  final int? count = jsonConvert.convert<int>(json['count']);
  if (count != null) {
    serviceEvaluateListEntity.count = count;
  }
  final int? page = jsonConvert.convert<int>(json['page']);
  if (page != null) {
    serviceEvaluateListEntity.page = page;
  }
  final int? limit = jsonConvert.convert<int>(json['limit']);
  if (limit != null) {
    serviceEvaluateListEntity.limit = limit;
  }
  final int? countPage = jsonConvert.convert<int>(json['count_page']);
  if (countPage != null) {
    serviceEvaluateListEntity.countPage = countPage;
  }
  final List<ServiceEvaluateListList>? list = (json['list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<ServiceEvaluateListList>(e) as ServiceEvaluateListList).toList();
  if (list != null) {
    serviceEvaluateListEntity.list = list;
  }
  return serviceEvaluateListEntity;
}

Map<String, dynamic> $ServiceEvaluateListEntityToJson(ServiceEvaluateListEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['count'] = entity.count;
  data['page'] = entity.page;
  data['limit'] = entity.limit;
  data['count_page'] = entity.countPage;
  data['list'] = entity.list.map((v) => v.toJson()).toList();
  return data;
}

extension ServiceEvaluateListEntityExtension on ServiceEvaluateListEntity {
  ServiceEvaluateListEntity copyWith({
    int? count,
    int? page,
    int? limit,
    int? countPage,
    List<ServiceEvaluateListList>? list,
  }) {
    return ServiceEvaluateListEntity()
      ..count = count ?? this.count
      ..page = page ?? this.page
      ..limit = limit ?? this.limit
      ..countPage = countPage ?? this.countPage
      ..list = list ?? this.list;
  }
}

ServiceEvaluateListList $ServiceEvaluateListListFromJson(Map<String, dynamic> json) {
  final ServiceEvaluateListList serviceEvaluateListList = ServiceEvaluateListList();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    serviceEvaluateListList.id = id;
  }
  final ServiceEvaluateListListAccount? account = jsonConvert.convert<ServiceEvaluateListListAccount>(json['account']);
  if (account != null) {
    serviceEvaluateListList.account = account;
  }
  final int? score = jsonConvert.convert<int>(json['score']);
  if (score != null) {
    serviceEvaluateListList.score = score;
  }
  final String? comment = jsonConvert.convert<String>(json['comment']);
  if (comment != null) {
    serviceEvaluateListList.comment = comment;
  }
  final List<dynamic>? resources = (json['resources'] as List<dynamic>?)?.map(
          (e) => e).toList();
  if (resources != null) {
    serviceEvaluateListList.resources = resources;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    serviceEvaluateListList.createdAt = createdAt;
  }
  return serviceEvaluateListList;
}

Map<String, dynamic> $ServiceEvaluateListListToJson(ServiceEvaluateListList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['account'] = entity.account.toJson();
  data['score'] = entity.score;
  data['comment'] = entity.comment;
  data['resources'] = entity.resources;
  data['created_at'] = entity.createdAt;
  return data;
}

extension ServiceEvaluateListListExtension on ServiceEvaluateListList {
  ServiceEvaluateListList copyWith({
    int? id,
    ServiceEvaluateListListAccount? account,
    int? score,
    String? comment,
    List<dynamic>? resources,
    String? createdAt,
  }) {
    return ServiceEvaluateListList()
      ..id = id ?? this.id
      ..account = account ?? this.account
      ..score = score ?? this.score
      ..comment = comment ?? this.comment
      ..resources = resources ?? this.resources
      ..createdAt = createdAt ?? this.createdAt;
  }
}

ServiceEvaluateListListAccount $ServiceEvaluateListListAccountFromJson(Map<String, dynamic> json) {
  final ServiceEvaluateListListAccount serviceEvaluateListListAccount = ServiceEvaluateListListAccount();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    serviceEvaluateListListAccount.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    serviceEvaluateListListAccount.name = name;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    serviceEvaluateListListAccount.avatar = avatar;
  }
  return serviceEvaluateListListAccount;
}

Map<String, dynamic> $ServiceEvaluateListListAccountToJson(ServiceEvaluateListListAccount entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['avatar'] = entity.avatar;
  return data;
}

extension ServiceEvaluateListListAccountExtension on ServiceEvaluateListListAccount {
  ServiceEvaluateListListAccount copyWith({
    int? id,
    String? name,
    String? avatar,
  }) {
    return ServiceEvaluateListListAccount()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..avatar = avatar ?? this.avatar;
  }
}