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


SGLabourRequestDetailEntity $SGLabourRequestDetailEntityFromJson(Map<String, dynamic> json) {
  final SGLabourRequestDetailEntity sGLabourRequestDetailEntity = SGLabourRequestDetailEntity();
  final SGLabourRequestDetailLabReq? labReq = jsonConvert.convert<SGLabourRequestDetailLabReq>(json['lab_req']);
  if (labReq != null) {
    sGLabourRequestDetailEntity.labReq = labReq;
  }
  final String? fromView = jsonConvert.convert<String>(json['from_view']);
  if (fromView != null) {
    sGLabourRequestDetailEntity.fromView = fromView;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    sGLabourRequestDetailEntity.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    sGLabourRequestDetailEntity.endTime = endTime;
  }
  final bool? isYY = jsonConvert.convert<bool>(json['is_yy']);
  if (isYY != null) {
    sGLabourRequestDetailEntity.isYY = isYY;
  }
  final List<IndexOptionEntity>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (outletList != null) {
    sGLabourRequestDetailEntity.outletList = outletList;
  }
  final List<IndexOptionEntity>? limitList = (json['limit_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (limitList != null) {
    sGLabourRequestDetailEntity.limitList = limitList;
  }
  final List<IndexOptionEntity>? requestType = (json['request_type'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (requestType != null) {
    sGLabourRequestDetailEntity.requestType = requestType;
  }
  final List<IndexOptionEntity>? positionList = (json['position_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (positionList != null) {
    sGLabourRequestDetailEntity.positionList = positionList;
  }
  return sGLabourRequestDetailEntity;
}

Map<String, dynamic> $SGLabourRequestDetailEntityToJson(SGLabourRequestDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['lab_req'] = entity.labReq?.toJson();
  data['from_view'] = entity.fromView;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['is_yy'] = entity.isYY;
  data['outlet_list'] = entity.outletList.map((v) => v.toJson()).toList();
  data['limit_list'] = entity.limitList.map((v) => v.toJson()).toList();
  data['request_type'] = entity.requestType.map((v) => v.toJson()).toList();
  data['position_list'] = entity.positionList.map((v) => v.toJson()).toList();
  return data;
}

extension SGLabourRequestDetailEntityExtension on SGLabourRequestDetailEntity {
  SGLabourRequestDetailEntity copyWith({
    SGLabourRequestDetailLabReq? labReq,
    String? fromView,
    String? startTime,
    String? endTime,
    bool? isYY,
    List<IndexOptionEntity>? outletList,
    List<IndexOptionEntity>? limitList,
    List<IndexOptionEntity>? requestType,
    List<IndexOptionEntity>? positionList,
  }) {
    return SGLabourRequestDetailEntity()
      ..labReq = labReq ?? this.labReq
      ..fromView = fromView ?? this.fromView
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..isYY = isYY ?? this.isYY
      ..outletList = outletList ?? this.outletList
      ..limitList = limitList ?? this.limitList
      ..requestType = requestType ?? this.requestType
      ..positionList = positionList ?? this.positionList;
  }
}

SGLabourRequestDetailLabReq $SGLabourRequestDetailLabReqFromJson(Map<String, dynamic> json) {
  final SGLabourRequestDetailLabReq sGLabourRequestDetailLabReq = SGLabourRequestDetailLabReq();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    sGLabourRequestDetailLabReq.id = id;
  }
  final int? employerId = jsonConvert.convert<int>(json['employer_id']);
  if (employerId != null) {
    sGLabourRequestDetailLabReq.employerId = employerId;
  }
  final String? employerName = jsonConvert.convert<String>(json['employer_name']);
  if (employerName != null) {
    sGLabourRequestDetailLabReq.employerName = employerName;
  }
  final int? eAdminId = jsonConvert.convert<int>(json['e_admin_id']);
  if (eAdminId != null) {
    sGLabourRequestDetailLabReq.eAdminId = eAdminId;
  }
  final int? sourceType = jsonConvert.convert<int>(json['source_type']);
  if (sourceType != null) {
    sGLabourRequestDetailLabReq.sourceType = sourceType;
  }
  final int? agencyId = jsonConvert.convert<int>(json['agency_id']);
  if (agencyId != null) {
    sGLabourRequestDetailLabReq.agencyId = agencyId;
  }
  final String? agencyName = jsonConvert.convert<String>(json['agency_name']);
  if (agencyName != null) {
    sGLabourRequestDetailLabReq.agencyName = agencyName;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    sGLabourRequestDetailLabReq.jobTitle = jobTitle;
  }
  final int? outletId = jsonConvert.convert<int>(json['outlet_id']);
  if (outletId != null) {
    sGLabourRequestDetailLabReq.outletId = outletId;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    sGLabourRequestDetailLabReq.outletName = outletName;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    sGLabourRequestDetailLabReq.jobDate = jobDate;
  }
  final int? startTime = jsonConvert.convert<int>(json['start_time']);
  if (startTime != null) {
    sGLabourRequestDetailLabReq.startTime = startTime;
  }
  final int? endTime = jsonConvert.convert<int>(json['end_time']);
  if (endTime != null) {
    sGLabourRequestDetailLabReq.endTime = endTime;
  }
  final String? workingHours = jsonConvert.convert<String>(json['working_hours']);
  if (workingHours != null) {
    sGLabourRequestDetailLabReq.workingHours = workingHours;
  }
  final String? hourlyRate = jsonConvert.convert<String>(json['hourly_rate']);
  if (hourlyRate != null) {
    sGLabourRequestDetailLabReq.hourlyRate = hourlyRate;
  }
  final int? hiringNum = jsonConvert.convert<int>(json['hiring_num']);
  if (hiringNum != null) {
    sGLabourRequestDetailLabReq.hiringNum = hiringNum;
  }
  final String? agencyRate = jsonConvert.convert<String>(json['agency_rate']);
  if (agencyRate != null) {
    sGLabourRequestDetailLabReq.agencyRate = agencyRate;
  }
  final int? jobTitleId = jsonConvert.convert<int>(json['job_title_id']);
  if (jobTitleId != null) {
    sGLabourRequestDetailLabReq.jobTitleId = jobTitleId;
  }
  final int? withFoodCert = jsonConvert.convert<int>(json['with_food_cert']);
  if (withFoodCert != null) {
    sGLabourRequestDetailLabReq.withFoodCert = withFoodCert;
  }
  final int? requestType = jsonConvert.convert<int>(json['request_type']);
  if (requestType != null) {
    sGLabourRequestDetailLabReq.requestType = requestType;
  }
  final int? sexLimit = jsonConvert.convert<int>(json['sex_limit']);
  if (sexLimit != null) {
    sGLabourRequestDetailLabReq.sexLimit = sexLimit;
  }
  final int? maleLimit = jsonConvert.convert<int>(json['male_limit']);
  if (maleLimit != null) {
    sGLabourRequestDetailLabReq.maleLimit = maleLimit;
  }
  final int? femaleLimit = jsonConvert.convert<int>(json['female_limit']);
  if (femaleLimit != null) {
    sGLabourRequestDetailLabReq.femaleLimit = femaleLimit;
  }
  final int? positionId = jsonConvert.convert<int>(json['position_id']);
  if (positionId != null) {
    sGLabourRequestDetailLabReq.positionId = positionId;
  }
  final String? positionName = jsonConvert.convert<String>(json['position_name']);
  if (positionName != null) {
    sGLabourRequestDetailLabReq.positionName = positionName;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    sGLabourRequestDetailLabReq.status = status;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    sGLabourRequestDetailLabReq.description = description;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    sGLabourRequestDetailLabReq.createdAt = createdAt;
  }
  final String? updatedAt = jsonConvert.convert<String>(json['updated_at']);
  if (updatedAt != null) {
    sGLabourRequestDetailLabReq.updatedAt = updatedAt;
  }
  final dynamic deletedAt = json['deleted_at'];
  if (deletedAt != null) {
    sGLabourRequestDetailLabReq.deletedAt = deletedAt;
  }
  final int? postId = jsonConvert.convert<int>(json['post_id']);
  if (postId != null) {
    sGLabourRequestDetailLabReq.postId = postId;
  }
  final String? postName = jsonConvert.convert<String>(json['post_name']);
  if (postName != null) {
    sGLabourRequestDetailLabReq.postName = postName;
  }
  return sGLabourRequestDetailLabReq;
}

Map<String, dynamic> $SGLabourRequestDetailLabReqToJson(SGLabourRequestDetailLabReq 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['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['agency_rate'] = entity.agencyRate;
  data['job_title_id'] = entity.jobTitleId;
  data['with_food_cert'] = entity.withFoodCert;
  data['request_type'] = entity.requestType;
  data['sex_limit'] = entity.sexLimit;
  data['male_limit'] = entity.maleLimit;
  data['female_limit'] = entity.femaleLimit;
  data['position_id'] = entity.positionId;
  data['position_name'] = entity.positionName;
  data['status'] = entity.status;
  data['description'] = entity.description;
  data['created_at'] = entity.createdAt;
  data['updated_at'] = entity.updatedAt;
  data['deleted_at'] = entity.deletedAt;
  data['post_id'] = entity.postId;
  data['post_name'] = entity.postName;
  return data;
}

extension SGLabourRequestDetailLabReqExtension on SGLabourRequestDetailLabReq {
  SGLabourRequestDetailLabReq copyWith({
    int? id,
    int? employerId,
    String? employerName,
    int? eAdminId,
    int? sourceType,
    int? agencyId,
    String? agencyName,
    String? jobTitle,
    int? outletId,
    String? outletName,
    String? jobDate,
    int? startTime,
    int? endTime,
    String? workingHours,
    String? hourlyRate,
    int? hiringNum,
    String? agencyRate,
    int? jobTitleId,
    int? withFoodCert,
    int? requestType,
    int? sexLimit,
    int? maleLimit,
    int? femaleLimit,
    int? positionId,
    String? positionName,
    int? status,
    String? description,
    String? createdAt,
    String? updatedAt,
    dynamic deletedAt,
    int? postId,
    String? postName,
  }) {
    return SGLabourRequestDetailLabReq()
      ..id = id ?? this.id
      ..employerId = employerId ?? this.employerId
      ..employerName = employerName ?? this.employerName
      ..eAdminId = eAdminId ?? this.eAdminId
      ..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
      ..agencyRate = agencyRate ?? this.agencyRate
      ..jobTitleId = jobTitleId ?? this.jobTitleId
      ..withFoodCert = withFoodCert ?? this.withFoodCert
      ..requestType = requestType ?? this.requestType
      ..sexLimit = sexLimit ?? this.sexLimit
      ..maleLimit = maleLimit ?? this.maleLimit
      ..femaleLimit = femaleLimit ?? this.femaleLimit
      ..positionId = positionId ?? this.positionId
      ..positionName = positionName ?? this.positionName
      ..status = status ?? this.status
      ..description = description ?? this.description
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..deletedAt = deletedAt ?? this.deletedAt
      ..postId = postId ?? this.postId
      ..postName = postName ?? this.postName;
  }
}