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

JobAppliedIndexSGEntity $JobAppliedIndexSGEntityFromJson(Map<String, dynamic> json) {
  final JobAppliedIndexSGEntity jobAppliedIndexSGEntity = JobAppliedIndexSGEntity();
  final String? jobId = jsonConvert.convert<String>(json['job_id']);
  if (jobId != null) {
    jobAppliedIndexSGEntity.jobId = jobId;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    jobAppliedIndexSGEntity.jobDate = jobDate;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    jobAppliedIndexSGEntity.jobTitle = jobTitle;
  }
  final List<JobAppliedIndexSGStatusList>? statusList = (json['status_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobAppliedIndexSGStatusList>(e) as JobAppliedIndexSGStatusList).toList();
  if (statusList != null) {
    jobAppliedIndexSGEntity.statusList = statusList;
  }
  final bool? canAppend = jsonConvert.convert<bool>(json['can_append']);
  if (canAppend != null) {
    jobAppliedIndexSGEntity.canAppend = canAppend;
  }
  return jobAppliedIndexSGEntity;
}

Map<String, dynamic> $JobAppliedIndexSGEntityToJson(JobAppliedIndexSGEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['job_id'] = entity.jobId;
  data['job_date'] = entity.jobDate;
  data['job_title'] = entity.jobTitle;
  data['status_list'] = entity.statusList.map((v) => v.toJson()).toList();
  data['can_append'] = entity.canAppend;
  return data;
}

extension JobAppliedIndexSGEntityExtension on JobAppliedIndexSGEntity {
  JobAppliedIndexSGEntity copyWith({
    String? jobId,
    String? jobDate,
    String? jobTitle,
    List<JobAppliedIndexSGStatusList>? statusList,
    bool? canAppend,
  }) {
    return JobAppliedIndexSGEntity()
      ..jobId = jobId ?? this.jobId
      ..jobDate = jobDate ?? this.jobDate
      ..jobTitle = jobTitle ?? this.jobTitle
      ..statusList = statusList ?? this.statusList
      ..canAppend = canAppend ?? this.canAppend;
  }
}

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

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

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