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


THAppliedIndexEntity $THAppliedIndexEntityFromJson(Map<String, dynamic> json) {
  final THAppliedIndexEntity tHAppliedIndexEntity = THAppliedIndexEntity();
  final String? jobId = jsonConvert.convert<String>(json['job_id']);
  if (jobId != null) {
    tHAppliedIndexEntity.jobId = jobId;
  }
  final THAppliedIndexJob? job = jsonConvert.convert<THAppliedIndexJob>(json['job']);
  if (job != null) {
    tHAppliedIndexEntity.job = job;
  }
  final List<IndexOptionEntity>? statusList = (json['status_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (statusList != null) {
    tHAppliedIndexEntity.statusList = statusList;
  }
  final bool? canAppend = jsonConvert.convert<bool>(json['can_append']);
  if (canAppend != null) {
    tHAppliedIndexEntity.canAppend = canAppend;
  }
  final String? sourceShow = jsonConvert.convert<String>(json['source_show']);
  if (sourceShow != null) {
    tHAppliedIndexEntity.sourceShow = sourceShow;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    tHAppliedIndexEntity.jobDate = jobDate;
  }
  final bool? isSuper = jsonConvert.convert<bool>(json['is_super']);
  if (isSuper != null) {
    tHAppliedIndexEntity.isSuper = isSuper;
  }
  return tHAppliedIndexEntity;
}

Map<String, dynamic> $THAppliedIndexEntityToJson(THAppliedIndexEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['job_id'] = entity.jobId;
  data['job'] = entity.job?.toJson();
  data['status_list'] = entity.statusList.map((v) => v.toJson()).toList();
  data['can_append'] = entity.canAppend;
  data['source_show'] = entity.sourceShow;
  data['job_date'] = entity.jobDate;
  data['is_super'] = entity.isSuper;
  return data;
}

extension THAppliedIndexEntityExtension on THAppliedIndexEntity {
  THAppliedIndexEntity copyWith({
    String? jobId,
    THAppliedIndexJob? job,
    List<IndexOptionEntity>? statusList,
    bool? canAppend,
    String? sourceShow,
    String? jobDate,
    bool? isSuper,
  }) {
    return THAppliedIndexEntity()
      ..jobId = jobId ?? this.jobId
      ..job = job ?? this.job
      ..statusList = statusList ?? this.statusList
      ..canAppend = canAppend ?? this.canAppend
      ..sourceShow = sourceShow ?? this.sourceShow
      ..jobDate = jobDate ?? this.jobDate
      ..isSuper = isSuper ?? this.isSuper;
  }
}

THAppliedIndexJob $THAppliedIndexJobFromJson(Map<String, dynamic> json) {
  final THAppliedIndexJob tHAppliedIndexJob = THAppliedIndexJob();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    tHAppliedIndexJob.id = id;
  }
  final String? employerId = jsonConvert.convert<String>(json['employer_id']);
  if (employerId != null) {
    tHAppliedIndexJob.employerId = employerId;
  }
  final String? employerName = jsonConvert.convert<String>(json['employer_name']);
  if (employerName != null) {
    tHAppliedIndexJob.employerName = employerName;
  }
  final String? eAdminId = jsonConvert.convert<String>(json['e_admin_id']);
  if (eAdminId != null) {
    tHAppliedIndexJob.eAdminId = eAdminId;
  }
  final String? yyJobId = jsonConvert.convert<String>(json['yy_job_id']);
  if (yyJobId != null) {
    tHAppliedIndexJob.yyJobId = yyJobId;
  }
  final String? sourceType = jsonConvert.convert<String>(json['source_type']);
  if (sourceType != null) {
    tHAppliedIndexJob.sourceType = sourceType;
  }
  final String? agencyId = jsonConvert.convert<String>(json['agency_id']);
  if (agencyId != null) {
    tHAppliedIndexJob.agencyId = agencyId;
  }
  final String? agencyName = jsonConvert.convert<String>(json['agency_name']);
  if (agencyName != null) {
    tHAppliedIndexJob.agencyName = agencyName;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    tHAppliedIndexJob.jobTitle = jobTitle;
  }
  final String? outletId = jsonConvert.convert<String>(json['outlet_id']);
  if (outletId != null) {
    tHAppliedIndexJob.outletId = outletId;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    tHAppliedIndexJob.outletName = outletName;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    tHAppliedIndexJob.jobDate = jobDate;
  }
  final int? startTime = jsonConvert.convert<int>(json['start_time']);
  if (startTime != null) {
    tHAppliedIndexJob.startTime = startTime;
  }
  final int? endTime = jsonConvert.convert<int>(json['end_time']);
  if (endTime != null) {
    tHAppliedIndexJob.endTime = endTime;
  }
  final String? workingHours = jsonConvert.convert<String>(json['working_hours']);
  if (workingHours != null) {
    tHAppliedIndexJob.workingHours = workingHours;
  }
  final String? hourlyRate = jsonConvert.convert<String>(json['hourly_rate']);
  if (hourlyRate != null) {
    tHAppliedIndexJob.hourlyRate = hourlyRate;
  }
  final String? hiringNum = jsonConvert.convert<String>(json['hiring_num']);
  if (hiringNum != null) {
    tHAppliedIndexJob.hiringNum = hiringNum;
  }
  final String? realNum = jsonConvert.convert<String>(json['real_num']);
  if (realNum != null) {
    tHAppliedIndexJob.realNum = realNum;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    tHAppliedIndexJob.status = status;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    tHAppliedIndexJob.description = description;
  }
  final int? confirmStatus = jsonConvert.convert<int>(json['confirm_status']);
  if (confirmStatus != null) {
    tHAppliedIndexJob.confirmStatus = confirmStatus;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    tHAppliedIndexJob.createdAt = createdAt;
  }
  final String? updatedAt = jsonConvert.convert<String>(json['updated_at']);
  if (updatedAt != null) {
    tHAppliedIndexJob.updatedAt = updatedAt;
  }
  final String? deletedAt = jsonConvert.convert<String>(json['deleted_at']);
  if (deletedAt != null) {
    tHAppliedIndexJob.deletedAt = deletedAt;
  }
  final String? eventName = jsonConvert.convert<String>(json['event_name']);
  if (eventName != null) {
    tHAppliedIndexJob.eventName = eventName;
  }
  final String? eventType = jsonConvert.convert<String>(json['event_type']);
  if (eventType != null) {
    tHAppliedIndexJob.eventType = eventType;
  }
  final String? withTyphoid = jsonConvert.convert<String>(json['with_typhoid']);
  if (withTyphoid != null) {
    tHAppliedIndexJob.withTyphoid = withTyphoid;
  }
  final String? syncPayroll = jsonConvert.convert<String>(json['sync_payroll']);
  if (syncPayroll != null) {
    tHAppliedIndexJob.syncPayroll = syncPayroll;
  }
  final String? agencyRate = jsonConvert.convert<String>(json['agency_rate']);
  if (agencyRate != null) {
    tHAppliedIndexJob.agencyRate = agencyRate;
  }
  final String? requestId = jsonConvert.convert<String>(json['request_id']);
  if (requestId != null) {
    tHAppliedIndexJob.requestId = requestId;
  }
  final String? jobTitleId = jsonConvert.convert<String>(json['job_title_id']);
  if (jobTitleId != null) {
    tHAppliedIndexJob.jobTitleId = jobTitleId;
  }
  final int? isOt = jsonConvert.convert<int>(json['is_ot']);
  if (isOt != null) {
    tHAppliedIndexJob.isOt = isOt;
  }
  final String? positionId = jsonConvert.convert<String>(json['position_id']);
  if (positionId != null) {
    tHAppliedIndexJob.positionId = positionId;
  }
  final int? sexLimit = jsonConvert.convert<int>(json['sex_limit']);
  if (sexLimit != null) {
    tHAppliedIndexJob.sexLimit = sexLimit;
  }
  final String? maleLimit = jsonConvert.convert<String>(json['male_limit']);
  if (maleLimit != null) {
    tHAppliedIndexJob.maleLimit = maleLimit;
  }
  final String? femaleLimit = jsonConvert.convert<String>(json['female_limit']);
  if (femaleLimit != null) {
    tHAppliedIndexJob.femaleLimit = femaleLimit;
  }
  return tHAppliedIndexJob;
}

Map<String, dynamic> $THAppliedIndexJobToJson(THAppliedIndexJob entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['employer_id'] = entity.employerId;
  data['employer_name'] = entity.employerName;
  data['e_admin_id'] = entity.eAdminId;
  data['yy_job_id'] = entity.yyJobId;
  data['source_type'] = entity.sourceType;
  data['agency_id'] = entity.agencyId;
  data['agency_name'] = entity.agencyName;
  data['job_title'] = entity.jobTitle;
  data['outlet_id'] = entity.outletId;
  data['outlet_name'] = entity.outletName;
  data['job_date'] = entity.jobDate;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['working_hours'] = entity.workingHours;
  data['hourly_rate'] = entity.hourlyRate;
  data['hiring_num'] = entity.hiringNum;
  data['real_num'] = entity.realNum;
  data['status'] = entity.status;
  data['description'] = entity.description;
  data['confirm_status'] = entity.confirmStatus;
  data['created_at'] = entity.createdAt;
  data['updated_at'] = entity.updatedAt;
  data['deleted_at'] = entity.deletedAt;
  data['event_name'] = entity.eventName;
  data['event_type'] = entity.eventType;
  data['with_typhoid'] = entity.withTyphoid;
  data['sync_payroll'] = entity.syncPayroll;
  data['agency_rate'] = entity.agencyRate;
  data['request_id'] = entity.requestId;
  data['job_title_id'] = entity.jobTitleId;
  data['is_ot'] = entity.isOt;
  data['position_id'] = entity.positionId;
  data['sex_limit'] = entity.sexLimit;
  data['male_limit'] = entity.maleLimit;
  data['female_limit'] = entity.femaleLimit;
  return data;
}

extension THAppliedIndexJobExtension on THAppliedIndexJob {
  THAppliedIndexJob copyWith({
    String? id,
    String? employerId,
    String? employerName,
    String? eAdminId,
    String? yyJobId,
    String? sourceType,
    String? agencyId,
    String? agencyName,
    String? jobTitle,
    String? outletId,
    String? outletName,
    String? jobDate,
    int? startTime,
    int? endTime,
    String? workingHours,
    String? hourlyRate,
    String? hiringNum,
    String? realNum,
    int? status,
    String? description,
    int? confirmStatus,
    String? createdAt,
    String? updatedAt,
    String? deletedAt,
    String? eventName,
    String? eventType,
    String? withTyphoid,
    String? syncPayroll,
    String? agencyRate,
    String? requestId,
    String? jobTitleId,
    int? isOt,
    String? positionId,
    int? sexLimit,
    String? maleLimit,
    String? femaleLimit,
  }) {
    return THAppliedIndexJob()
      ..id = id ?? this.id
      ..employerId = employerId ?? this.employerId
      ..employerName = employerName ?? this.employerName
      ..eAdminId = eAdminId ?? this.eAdminId
      ..yyJobId = yyJobId ?? this.yyJobId
      ..sourceType = sourceType ?? this.sourceType
      ..agencyId = agencyId ?? this.agencyId
      ..agencyName = agencyName ?? this.agencyName
      ..jobTitle = jobTitle ?? this.jobTitle
      ..outletId = outletId ?? this.outletId
      ..outletName = outletName ?? this.outletName
      ..jobDate = jobDate ?? this.jobDate
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..workingHours = workingHours ?? this.workingHours
      ..hourlyRate = hourlyRate ?? this.hourlyRate
      ..hiringNum = hiringNum ?? this.hiringNum
      ..realNum = realNum ?? this.realNum
      ..status = status ?? this.status
      ..description = description ?? this.description
      ..confirmStatus = confirmStatus ?? this.confirmStatus
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..deletedAt = deletedAt ?? this.deletedAt
      ..eventName = eventName ?? this.eventName
      ..eventType = eventType ?? this.eventType
      ..withTyphoid = withTyphoid ?? this.withTyphoid
      ..syncPayroll = syncPayroll ?? this.syncPayroll
      ..agencyRate = agencyRate ?? this.agencyRate
      ..requestId = requestId ?? this.requestId
      ..jobTitleId = jobTitleId ?? this.jobTitleId
      ..isOt = isOt ?? this.isOt
      ..positionId = positionId ?? this.positionId
      ..sexLimit = sexLimit ?? this.sexLimit
      ..maleLimit = maleLimit ?? this.maleLimit
      ..femaleLimit = femaleLimit ?? this.femaleLimit;
  }
}