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

JobListIndexSGEntity $JobListIndexSGEntityFromJson(Map<String, dynamic> json) {
  final JobListIndexSGEntity jobListIndexSGEntity = JobListIndexSGEntity();
  final String? startDate = jsonConvert.convert<String>(json['start_date']);
  if (startDate != null) {
    jobListIndexSGEntity.startDate = startDate;
  }
  final String? endDate = jsonConvert.convert<String>(json['end_date']);
  if (endDate != null) {
    jobListIndexSGEntity.endDate = endDate;
  }
  final List<JobListIndexSGOption>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListIndexSGOption>(e) as JobListIndexSGOption).toList();
  if (outletList != null) {
    jobListIndexSGEntity.outletList = outletList;
  }
  final List<JobListIndexSGOption>? statusList = (json['status_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListIndexSGOption>(e) as JobListIndexSGOption).toList();
  if (statusList != null) {
    jobListIndexSGEntity.statusList = statusList;
  }
  final List<JobListIndexSGOption>? agencyList = (json['agency_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListIndexSGOption>(e) as JobListIndexSGOption).toList();
  if (agencyList != null) {
    jobListIndexSGEntity.agencyList = agencyList;
  }
  return jobListIndexSGEntity;
}

Map<String, dynamic> $JobListIndexSGEntityToJson(JobListIndexSGEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['start_date'] = entity.startDate;
  data['end_date'] = entity.endDate;
  data['outlet_list'] = entity.outletList.map((v) => v.toJson()).toList();
  data['status_list'] = entity.statusList.map((v) => v.toJson()).toList();
  data['agency_list'] = entity.agencyList.map((v) => v.toJson()).toList();
  return data;
}

extension JobListIndexSGEntityExtension on JobListIndexSGEntity {
  JobListIndexSGEntity copyWith({
    String? startDate,
    String? endDate,
    List<JobListIndexSGOption>? outletList,
    List<JobListIndexSGOption>? statusList,
    List<JobListIndexSGOption>? agencyList,
  }) {
    return JobListIndexSGEntity()
      ..startDate = startDate ?? this.startDate
      ..endDate = endDate ?? this.endDate
      ..outletList = outletList ?? this.outletList
      ..statusList = statusList ?? this.statusList
      ..agencyList = agencyList ?? this.agencyList;
  }
}

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

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

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