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


JobTemplateEditIndexEntity $JobTemplateEditIndexEntityFromJson(Map<String, dynamic> json) {
  final JobTemplateEditIndexEntity jobTemplateEditIndexEntity = JobTemplateEditIndexEntity();
  final int? templateId = jsonConvert.convert<int>(json['template_id']);
  if (templateId != null) {
    jobTemplateEditIndexEntity.templateId = templateId;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    jobTemplateEditIndexEntity.name = name;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    jobTemplateEditIndexEntity.jobTitle = jobTitle;
  }
  final String? contact = jsonConvert.convert<String>(json['contact']);
  if (contact != null) {
    jobTemplateEditIndexEntity.contact = contact;
  }
  final String? contactNo = jsonConvert.convert<String>(json['contact_no']);
  if (contactNo != null) {
    jobTemplateEditIndexEntity.contactNo = contactNo;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    jobTemplateEditIndexEntity.description = description;
  }
  final String? note = jsonConvert.convert<String>(json['note']);
  if (note != null) {
    jobTemplateEditIndexEntity.note = note;
  }
  final int? withFoodCert = jsonConvert.convert<int>(json['with_food_cert']);
  if (withFoodCert != null) {
    jobTemplateEditIndexEntity.withFoodCert = withFoodCert;
  }
  final List<JobTemplateEditIndexAgeList>? ageList = (json['age_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobTemplateEditIndexAgeList>(e) as JobTemplateEditIndexAgeList).toList();
  if (ageList != null) {
    jobTemplateEditIndexEntity.ageList = ageList;
  }
  final List<JobTemplateEditIndexSexList>? sexList = (json['sex_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobTemplateEditIndexSexList>(e) as JobTemplateEditIndexSexList).toList();
  if (sexList != null) {
    jobTemplateEditIndexEntity.sexList = sexList;
  }
  final List<JobTemplateEditIndexLanguageList>? languageList = (json['language_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobTemplateEditIndexLanguageList>(e) as JobTemplateEditIndexLanguageList).toList();
  if (languageList != null) {
    jobTemplateEditIndexEntity.languageList = languageList;
  }
  final List<IndexOptionEntity>? positionList = (json['position_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (positionList != null) {
    jobTemplateEditIndexEntity.positionList = positionList;
  }
  return jobTemplateEditIndexEntity;
}

Map<String, dynamic> $JobTemplateEditIndexEntityToJson(JobTemplateEditIndexEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['template_id'] = entity.templateId;
  data['name'] = entity.name;
  data['job_title'] = entity.jobTitle;
  data['contact'] = entity.contact;
  data['contact_no'] = entity.contactNo;
  data['description'] = entity.description;
  data['note'] = entity.note;
  data['with_food_cert'] = entity.withFoodCert;
  data['age_list'] = entity.ageList.map((v) => v.toJson()).toList();
  data['sex_list'] = entity.sexList.map((v) => v.toJson()).toList();
  data['language_list'] = entity.languageList.map((v) => v.toJson()).toList();
  data['position_list'] = entity.positionList.map((v) => v.toJson()).toList();
  return data;
}

extension JobTemplateEditIndexEntityExtension on JobTemplateEditIndexEntity {
  JobTemplateEditIndexEntity copyWith({
    int? templateId,
    String? name,
    String? jobTitle,
    String? contact,
    String? contactNo,
    String? description,
    String? note,
    int? withFoodCert,
    List<JobTemplateEditIndexAgeList>? ageList,
    List<JobTemplateEditIndexSexList>? sexList,
    List<JobTemplateEditIndexLanguageList>? languageList,
    List<IndexOptionEntity>? positionList,
  }) {
    return JobTemplateEditIndexEntity()
      ..templateId = templateId ?? this.templateId
      ..name = name ?? this.name
      ..jobTitle = jobTitle ?? this.jobTitle
      ..contact = contact ?? this.contact
      ..contactNo = contactNo ?? this.contactNo
      ..description = description ?? this.description
      ..note = note ?? this.note
      ..withFoodCert = withFoodCert ?? this.withFoodCert
      ..ageList = ageList ?? this.ageList
      ..sexList = sexList ?? this.sexList
      ..languageList = languageList ?? this.languageList
      ..positionList = positionList ?? this.positionList;
  }
}

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

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

extension JobTemplateEditIndexAgeListExtension on JobTemplateEditIndexAgeList {
  JobTemplateEditIndexAgeList copyWith({
    String? value,
    String? txt,
    String? checked,
  }) {
    return JobTemplateEditIndexAgeList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..checked = checked ?? this.checked;
  }
}

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

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

extension JobTemplateEditIndexSexListExtension on JobTemplateEditIndexSexList {
  JobTemplateEditIndexSexList copyWith({
    String? value,
    String? txt,
    String? checked,
  }) {
    return JobTemplateEditIndexSexList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..checked = checked ?? this.checked;
  }
}

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

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

extension JobTemplateEditIndexLanguageListExtension on JobTemplateEditIndexLanguageList {
  JobTemplateEditIndexLanguageList copyWith({
    String? value,
    String? txt,
    String? checked,
  }) {
    return JobTemplateEditIndexLanguageList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..checked = checked ?? this.checked;
  }
}