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

JobListEditIndexSGEntity $JobListEditIndexSGEntityFromJson(Map<String, dynamic> json) {
  final JobListEditIndexSGEntity jobListEditIndexSGEntity = JobListEditIndexSGEntity();
  final String? jobId = jsonConvert.convert<String>(json['job_id']);
  if (jobId != null) {
    jobListEditIndexSGEntity.jobId = jobId;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    jobListEditIndexSGEntity.jobTitle = jobTitle;
  }
  final int? outletId = jsonConvert.convert<int>(json['outlet_id']);
  if (outletId != null) {
    jobListEditIndexSGEntity.outletId = outletId;
  }
  final int? reqType = jsonConvert.convert<int>(json['req_type']);
  if (reqType != null) {
    jobListEditIndexSGEntity.reqType = reqType;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    jobListEditIndexSGEntity.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    jobListEditIndexSGEntity.endTime = endTime;
  }
  final int? sexLimit = jsonConvert.convert<int>(json['sex_limit']);
  if (sexLimit != null) {
    jobListEditIndexSGEntity.sexLimit = sexLimit;
  }
  final int? maleLimit = jsonConvert.convert<int>(json['male_limit']);
  if (maleLimit != null) {
    jobListEditIndexSGEntity.maleLimit = maleLimit;
  }
  final int? femaleLimit = jsonConvert.convert<int>(json['female_limit']);
  if (femaleLimit != null) {
    jobListEditIndexSGEntity.femaleLimit = femaleLimit;
  }
  final int? needNum = jsonConvert.convert<int>(json['need_num']);
  if (needNum != null) {
    jobListEditIndexSGEntity.needNum = needNum;
  }
  final String? remark = jsonConvert.convert<String>(json['remark']);
  if (remark != null) {
    jobListEditIndexSGEntity.remark = remark;
  }
  final String? disabled = jsonConvert.convert<String>(json['disabled']);
  if (disabled != null) {
    jobListEditIndexSGEntity.disabled = disabled;
  }
  final bool? isYY = jsonConvert.convert<bool>(json['is_yy']);
  if (isYY != null) {
    jobListEditIndexSGEntity.isYY = isYY;
  }
  final List<JobListEditIndexOption>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListEditIndexOption>(e) as JobListEditIndexOption).toList();
  if (outletList != null) {
    jobListEditIndexSGEntity.outletList = outletList;
  }
  final List<JobListEditIndexOption>? requestType = (json['request_type'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListEditIndexOption>(e) as JobListEditIndexOption).toList();
  if (requestType != null) {
    jobListEditIndexSGEntity.requestType = requestType;
  }
  final List<JobListEditIndexOption>? positionList = (json['position_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListEditIndexOption>(e) as JobListEditIndexOption).toList();
  if (positionList != null) {
    jobListEditIndexSGEntity.positionList = positionList;
  }
  final List<JobListEditIndexOption>? limitList = (json['limit_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListEditIndexOption>(e) as JobListEditIndexOption).toList();
  if (limitList != null) {
    jobListEditIndexSGEntity.limitList = limitList;
  }
  return jobListEditIndexSGEntity;
}

Map<String, dynamic> $JobListEditIndexSGEntityToJson(JobListEditIndexSGEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['job_id'] = entity.jobId;
  data['job_title'] = entity.jobTitle;
  data['outlet_id'] = entity.outletId;
  data['req_type'] = entity.reqType;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['sex_limit'] = entity.sexLimit;
  data['male_limit'] = entity.maleLimit;
  data['female_limit'] = entity.femaleLimit;
  data['need_num'] = entity.needNum;
  data['remark'] = entity.remark;
  data['disabled'] = entity.disabled;
  data['is_yy'] = entity.isYY;
  data['outlet_list'] = entity.outletList.map((v) => v.toJson()).toList();
  data['request_type'] = entity.requestType.map((v) => v.toJson()).toList();
  data['position_list'] = entity.positionList.map((v) => v.toJson()).toList();
  data['limit_list'] = entity.limitList.map((v) => v.toJson()).toList();
  return data;
}

extension JobListEditIndexSGEntityExtension on JobListEditIndexSGEntity {
  JobListEditIndexSGEntity copyWith({
    String? jobId,
    String? jobTitle,
    int? outletId,
    int? reqType,
    String? startTime,
    String? endTime,
    int? sexLimit,
    int? maleLimit,
    int? femaleLimit,
    int? needNum,
    String? remark,
    String? disabled,
    bool? isYY,
    List<JobListEditIndexOption>? outletList,
    List<JobListEditIndexOption>? requestType,
    List<JobListEditIndexOption>? positionList,
    List<JobListEditIndexOption>? limitList,
  }) {
    return JobListEditIndexSGEntity()
      ..jobId = jobId ?? this.jobId
      ..jobTitle = jobTitle ?? this.jobTitle
      ..outletId = outletId ?? this.outletId
      ..reqType = reqType ?? this.reqType
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..sexLimit = sexLimit ?? this.sexLimit
      ..maleLimit = maleLimit ?? this.maleLimit
      ..femaleLimit = femaleLimit ?? this.femaleLimit
      ..needNum = needNum ?? this.needNum
      ..remark = remark ?? this.remark
      ..disabled = disabled ?? this.disabled
      ..isYY = isYY ?? this.isYY
      ..outletList = outletList ?? this.outletList
      ..requestType = requestType ?? this.requestType
      ..positionList = positionList ?? this.positionList
      ..limitList = limitList ?? this.limitList;
  }
}

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

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

extension JobListEditIndexOptionExtension on JobListEditIndexOption {
  JobListEditIndexOption copyWith({
    String? value,
    String? txt,
    String? selected,
    String? checked,
  }) {
    return JobListEditIndexOption()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..selected = selected ?? this.selected
      ..checked = checked ?? this.checked;
  }
}