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


JobListEROptionEntity $JobListEROptionEntityFromJson(Map<String, dynamic> json) {
  final JobListEROptionEntity jobListEROptionEntity = JobListEROptionEntity();
  final List<IndexOptionEntity>? divisionList = (json['division_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (divisionList != null) {
    jobListEROptionEntity.divisionList = divisionList;
  }
  final List<IndexOptionEntity>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (outletList != null) {
    jobListEROptionEntity.outletList = outletList;
  }
  final bool? withOt = jsonConvert.convert<bool>(json['with_ot']);
  if (withOt != null) {
    jobListEROptionEntity.withOt = withOt;
  }
  final List<IndexOptionEntity>? statusList = (json['status_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (statusList != null) {
    jobListEROptionEntity.statusList = statusList;
  }
  final bool? withOtJob = jsonConvert.convert<bool>(json['with_ot_job']);
  if (withOtJob != null) {
    jobListEROptionEntity.withOtJob = withOtJob;
  }
  final JobListEROptionFilter? filter = jsonConvert.convert<JobListEROptionFilter>(json['filter']);
  if (filter != null) {
    jobListEROptionEntity.filter = filter;
  }
  final String? view = jsonConvert.convert<String>(json['view']);
  if (view != null) {
    jobListEROptionEntity.view = view;
  }
  return jobListEROptionEntity;
}

Map<String, dynamic> $JobListEROptionEntityToJson(JobListEROptionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['division_list'] = entity.divisionList?.map((v) => v.toJson()).toList();
  data['outlet_list'] = entity.outletList?.map((v) => v.toJson()).toList();
  data['with_ot'] = entity.withOt;
  data['status_list'] = entity.statusList?.map((v) => v.toJson()).toList();
  data['with_ot_job'] = entity.withOtJob;
  data['filter'] = entity.filter?.toJson();
  data['view'] = entity.view;
  return data;
}

extension JobListEROptionEntityExtension on JobListEROptionEntity {
  JobListEROptionEntity copyWith({
    List<IndexOptionEntity>? divisionList,
    List<IndexOptionEntity>? outletList,
    bool? withOt,
    List<IndexOptionEntity>? statusList,
    bool? withOtJob,
    JobListEROptionFilter? filter,
    String? view,
  }) {
    return JobListEROptionEntity()
      ..divisionList = divisionList ?? this.divisionList
      ..outletList = outletList ?? this.outletList
      ..withOt = withOt ?? this.withOt
      ..statusList = statusList ?? this.statusList
      ..withOtJob = withOtJob ?? this.withOtJob
      ..filter = filter ?? this.filter
      ..view = view ?? this.view;
  }
}

JobListEROptionFilter $JobListEROptionFilterFromJson(Map<String, dynamic> json) {
  final JobListEROptionFilter jobListEROptionFilter = JobListEROptionFilter();
  final String? startDate = jsonConvert.convert<String>(json['start_date']);
  if (startDate != null) {
    jobListEROptionFilter.startDate = startDate;
  }
  final String? endDate = jsonConvert.convert<String>(json['end_date']);
  if (endDate != null) {
    jobListEROptionFilter.endDate = endDate;
  }
  return jobListEROptionFilter;
}

Map<String, dynamic> $JobListEROptionFilterToJson(JobListEROptionFilter entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['start_date'] = entity.startDate;
  data['end_date'] = entity.endDate;
  return data;
}

extension JobListEROptionFilterExtension on JobListEROptionFilter {
  JobListEROptionFilter copyWith({
    String? startDate,
    String? endDate,
  }) {
    return JobListEROptionFilter()
      ..startDate = startDate ?? this.startDate
      ..endDate = endDate ?? this.endDate;
  }
}