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

JobListAppliedEditEntity $JobListAppliedEditEntityFromJson(Map<String, dynamic> json) {
  final JobListAppliedEditEntity jobListAppliedEditEntity = JobListAppliedEditEntity();
  final int? appliedId = jsonConvert.convert<int>(json['applied_id']);
  if (appliedId != null) {
    jobListAppliedEditEntity.appliedId = appliedId;
  }
  final String? memberName = jsonConvert.convert<String>(json['member_name']);
  if (memberName != null) {
    jobListAppliedEditEntity.memberName = memberName;
  }
  final String? jobUnit = jsonConvert.convert<String>(json['job_unit']);
  if (jobUnit != null) {
    jobListAppliedEditEntity.jobUnit = jobUnit;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    jobListAppliedEditEntity.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    jobListAppliedEditEntity.endTime = endTime;
  }
  final String? securityIn = jsonConvert.convert<String>(json['security_in']);
  if (securityIn != null) {
    jobListAppliedEditEntity.securityIn = securityIn;
  }
  final String? securityOut = jsonConvert.convert<String>(json['security_out']);
  if (securityOut != null) {
    jobListAppliedEditEntity.securityOut = securityOut;
  }
  final String? workIn = jsonConvert.convert<String>(json['work_in']);
  if (workIn != null) {
    jobListAppliedEditEntity.workIn = workIn;
  }
  final String? workOut = jsonConvert.convert<String>(json['work_out']);
  if (workOut != null) {
    jobListAppliedEditEntity.workOut = workOut;
  }
  final String? adjustHours = jsonConvert.convert<String>(json['adjust_hours']);
  if (adjustHours != null) {
    jobListAppliedEditEntity.adjustHours = adjustHours;
  }
  final int? totalRooms = jsonConvert.convert<int>(json['total_rooms']);
  if (totalRooms != null) {
    jobListAppliedEditEntity.totalRooms = totalRooms;
  }
  final List<JobListAppliedEditReasonList>? reasonList = (json['reason_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<JobListAppliedEditReasonList>(e) as JobListAppliedEditReasonList).toList();
  if (reasonList != null) {
    jobListAppliedEditEntity.reasonList = reasonList;
  }
  final int? reasonType = jsonConvert.convert<int>(json['reason_type']);
  if (reasonType != null) {
    jobListAppliedEditEntity.reasonType = reasonType;
  }
  final String? coReason = jsonConvert.convert<String>(json['co_reason']);
  if (coReason != null) {
    jobListAppliedEditEntity.coReason = coReason;
  }
  return jobListAppliedEditEntity;
}

Map<String, dynamic> $JobListAppliedEditEntityToJson(JobListAppliedEditEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['applied_id'] = entity.appliedId;
  data['member_name'] = entity.memberName;
  data['job_unit'] = entity.jobUnit;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['security_in'] = entity.securityIn;
  data['security_out'] = entity.securityOut;
  data['work_in'] = entity.workIn;
  data['work_out'] = entity.workOut;
  data['adjust_hours'] = entity.adjustHours;
  data['total_rooms'] = entity.totalRooms;
  data['reason_list'] = entity.reasonList?.map((v) => v.toJson()).toList();
  data['reason_type'] = entity.reasonType;
  data['co_reason'] = entity.coReason;
  return data;
}

extension JobListAppliedEditEntityExtension on JobListAppliedEditEntity {
  JobListAppliedEditEntity copyWith({
    int? appliedId,
    String? memberName,
    String? jobUnit,
    String? startTime,
    String? endTime,
    String? securityIn,
    String? securityOut,
    String? workIn,
    String? workOut,
    String? adjustHours,
    int? totalRooms,
    List<JobListAppliedEditReasonList>? reasonList,
    int? reasonType,
    String? coReason,
  }) {
    return JobListAppliedEditEntity()
      ..appliedId = appliedId ?? this.appliedId
      ..memberName = memberName ?? this.memberName
      ..jobUnit = jobUnit ?? this.jobUnit
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..securityIn = securityIn ?? this.securityIn
      ..securityOut = securityOut ?? this.securityOut
      ..workIn = workIn ?? this.workIn
      ..workOut = workOut ?? this.workOut
      ..adjustHours = adjustHours ?? this.adjustHours
      ..totalRooms = totalRooms ?? this.totalRooms
      ..reasonList = reasonList ?? this.reasonList
      ..reasonType = reasonType ?? this.reasonType
      ..coReason = coReason ?? this.coReason;
  }
}

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

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

extension JobListAppliedEditReasonListExtension on JobListAppliedEditReasonList {
  JobListAppliedEditReasonList copyWith({
    int? value,
    String? txt,
    String? checked,
  }) {
    return JobListAppliedEditReasonList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..checked = checked ?? this.checked;
  }
}