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

ReviseIndexSGEntity $ReviseIndexSGEntityFromJson(Map<String, dynamic> json) {
  final ReviseIndexSGEntity reviseIndexSGEntity = ReviseIndexSGEntity();
  final List<ReviseIndexSGStatusList>? statusList = (json['status_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<ReviseIndexSGStatusList>(e) as ReviseIndexSGStatusList).toList();
  if (statusList != null) {
    reviseIndexSGEntity.statusList = statusList;
  }
  return reviseIndexSGEntity;
}

Map<String, dynamic> $ReviseIndexSGEntityToJson(ReviseIndexSGEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['status_list'] = entity.statusList.map((v) => v.toJson()).toList();
  return data;
}

extension ReviseIndexSGEntityExtension on ReviseIndexSGEntity {
  ReviseIndexSGEntity copyWith({
    List<ReviseIndexSGStatusList>? statusList,
  }) {
    return ReviseIndexSGEntity()
      ..statusList = statusList ?? this.statusList;
  }
}

ReviseIndexSGStatusList $ReviseIndexSGStatusListFromJson(Map<String, dynamic> json) {
  final ReviseIndexSGStatusList reviseIndexSGStatusList = ReviseIndexSGStatusList();
  final String? value = jsonConvert.convert<String>(json['value']);
  if (value != null) {
    reviseIndexSGStatusList.value = value;
  }
  final String? txt = jsonConvert.convert<String>(json['txt']);
  if (txt != null) {
    reviseIndexSGStatusList.txt = txt;
  }
  final String? selected = jsonConvert.convert<String>(json['selected']);
  if (selected != null) {
    reviseIndexSGStatusList.selected = selected;
  }
  return reviseIndexSGStatusList;
}

Map<String, dynamic> $ReviseIndexSGStatusListToJson(ReviseIndexSGStatusList entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['value'] = entity.value;
  data['txt'] = entity.txt;
  data['selected'] = entity.selected;
  return data;
}

extension ReviseIndexSGStatusListExtension on ReviseIndexSGStatusList {
  ReviseIndexSGStatusList copyWith({
    String? value,
    String? txt,
    String? selected,
  }) {
    return ReviseIndexSGStatusList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..selected = selected ?? this.selected;
  }
}