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

FacilityIndexEntity $FacilityIndexEntityFromJson(Map<String, dynamic> json) {
  final FacilityIndexEntity facilityIndexEntity = FacilityIndexEntity();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    facilityIndexEntity.id = id;
  }
  final String? icon = jsonConvert.convert<String>(json['icon']);
  if (icon != null) {
    facilityIndexEntity.icon = icon;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    facilityIndexEntity.name = name;
  }
  final List<String>? mapResources = (json['map_resources'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (mapResources != null) {
    facilityIndexEntity.mapResources = mapResources;
  }
  return facilityIndexEntity;
}

Map<String, dynamic> $FacilityIndexEntityToJson(FacilityIndexEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['icon'] = entity.icon;
  data['name'] = entity.name;
  data['map_resources'] = entity.mapResources;
  return data;
}

extension FacilityIndexEntityExtension on FacilityIndexEntity {
  FacilityIndexEntity copyWith({
    String? id,
    String? icon,
    String? name,
    List<String>? mapResources,
  }) {
    return FacilityIndexEntity()
      ..id = id ?? this.id
      ..icon = icon ?? this.icon
      ..name = name ?? this.name
      ..mapResources = mapResources ?? this.mapResources;
  }
}