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

JobListIndexEntity $JobListIndexEntityFromJson(Map<String, dynamic> json) {
  final JobListIndexEntity jobListIndexEntity = JobListIndexEntity();
  final List<JobListIndexDepartmentList>? departmentList = (json['department_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListIndexDepartmentList>(e) as JobListIndexDepartmentList).toList();
  if (departmentList != null) {
    jobListIndexEntity.departmentList = departmentList;
  }
  final List<JobListIndexStatusList>? statusList = (json['status_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListIndexStatusList>(e) as JobListIndexStatusList).toList();
  if (statusList != null) {
    jobListIndexEntity.statusList = statusList;
  }
  return jobListIndexEntity;
}

Map<String, dynamic> $JobListIndexEntityToJson(JobListIndexEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['department_list'] = entity.departmentList?.map((v) => v.toJson()).toList();
  data['status_list'] = entity.statusList?.map((v) => v.toJson()).toList();
  return data;
}

extension JobListIndexEntityExtension on JobListIndexEntity {
  JobListIndexEntity copyWith({
    List<JobListIndexDepartmentList>? departmentList,
    List<JobListIndexStatusList>? statusList,
  }) {
    return JobListIndexEntity()
      ..departmentList = departmentList ?? this.departmentList
      ..statusList = statusList ?? this.statusList;
  }
}

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

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

extension JobListIndexDepartmentListExtension on JobListIndexDepartmentList {
  JobListIndexDepartmentList copyWith({
    int? value,
    String? txt,
    String? selected,
  }) {
    return JobListIndexDepartmentList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..selected = selected ?? this.selected;
  }
}

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

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

extension JobListIndexStatusListExtension on JobListIndexStatusList {
  JobListIndexStatusList copyWith({
    int? value,
    String? txt,
    String? selected,
  }) {
    return JobListIndexStatusList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..selected = selected ?? this.selected;
  }
}