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


THOALabourDetailEntity $THOALabourDetailEntityFromJson(Map<String, dynamic> json) {
  final THOALabourDetailEntity tHOALabourDetailEntity = THOALabourDetailEntity();
  final THOALabourDetailLabourRequest? labReq = jsonConvert.convert<THOALabourDetailLabourRequest>(json['labour_request']);
  if (labReq != null) {
    tHOALabourDetailEntity.labReq = labReq;
  }
  final String? fromView = jsonConvert.convert<String>(json['from_view']);
  if (fromView != null) {
    tHOALabourDetailEntity.fromView = fromView;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    tHOALabourDetailEntity.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    tHOALabourDetailEntity.endTime = endTime;
  }
  final bool? withOt = jsonConvert.convert<bool>(json['with_ot']);
  if (withOt != null) {
    tHOALabourDetailEntity.withOt = withOt;
  }
  final List<IndexOptionEntity>? titleList = (json['title_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (titleList != null) {
    tHOALabourDetailEntity.titleList = titleList;
  }
  final List<IndexOptionEntity>? limitList = (json['limit_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (limitList != null) {
    tHOALabourDetailEntity.limitList = limitList;
  }
  final List<IndexOptionEntity>? employmentList = (json['employment_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (employmentList != null) {
    tHOALabourDetailEntity.employmentList = employmentList;
  }
  final List<IndexOptionEntity>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (outletList != null) {
    tHOALabourDetailEntity.outletList = outletList;
  }
  final List<IndexOptionEntity>? otRadios = (json['ot_radios'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (otRadios != null) {
    tHOALabourDetailEntity.otRadios = otRadios;
  }
  final String? view = jsonConvert.convert<String>(json['view']);
  if (view != null) {
    tHOALabourDetailEntity.view = view;
  }
  return tHOALabourDetailEntity;
}

Map<String, dynamic> $THOALabourDetailEntityToJson(THOALabourDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['labour_request'] = entity.labReq?.toJson();
  data['from_view'] = entity.fromView;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['with_ot'] = entity.withOt;
  data['title_list'] = entity.titleList.map((v) => v.toJson()).toList();
  data['limit_list'] = entity.limitList.map((v) => v.toJson()).toList();
  data['employment_list'] = entity.employmentList.map((v) => v.toJson()).toList();
  data['outlet_list'] = entity.outletList.map((v) => v.toJson()).toList();
  data['ot_radios'] = entity.otRadios.map((v) => v.toJson()).toList();
  data['view'] = entity.view;
  return data;
}

extension THOALabourDetailEntityExtension on THOALabourDetailEntity {
  THOALabourDetailEntity copyWith({
    THOALabourDetailLabourRequest? labReq,
    String? fromView,
    String? startTime,
    String? endTime,
    bool? withOt,
    List<IndexOptionEntity>? titleList,
    List<IndexOptionEntity>? limitList,
    List<IndexOptionEntity>? employmentList,
    List<IndexOptionEntity>? outletList,
    List<IndexOptionEntity>? otRadios,
    String? view,
  }) {
    return THOALabourDetailEntity()
      ..labReq = labReq ?? this.labReq
      ..fromView = fromView ?? this.fromView
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..withOt = withOt ?? this.withOt
      ..titleList = titleList ?? this.titleList
      ..limitList = limitList ?? this.limitList
      ..employmentList = employmentList ?? this.employmentList
      ..outletList = outletList ?? this.outletList
      ..otRadios = otRadios ?? this.otRadios
      ..view = view ?? this.view;
  }
}

THOALabourDetailLabourRequest $THOALabourDetailLabourRequestFromJson(Map<String, dynamic> json) {
  final THOALabourDetailLabourRequest tHOALabourDetailLabourRequest = THOALabourDetailLabourRequest();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    tHOALabourDetailLabourRequest.id = id;
  }
  final int? employerId = jsonConvert.convert<int>(json['employer_id']);
  if (employerId != null) {
    tHOALabourDetailLabourRequest.employerId = employerId;
  }
  final int? sourceType = jsonConvert.convert<int>(json['source_type']);
  if (sourceType != null) {
    tHOALabourDetailLabourRequest.sourceType = sourceType;
  }
  final int? agencyId = jsonConvert.convert<int>(json['agency_id']);
  if (agencyId != null) {
    tHOALabourDetailLabourRequest.agencyId = agencyId;
  }
  final String? agencyName = jsonConvert.convert<String>(json['agency_name']);
  if (agencyName != null) {
    tHOALabourDetailLabourRequest.agencyName = agencyName;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    tHOALabourDetailLabourRequest.jobTitle = jobTitle;
  }
  final int? outletId = jsonConvert.convert<int>(json['outlet_id']);
  if (outletId != null) {
    tHOALabourDetailLabourRequest.outletId = outletId;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    tHOALabourDetailLabourRequest.outletName = outletName;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    tHOALabourDetailLabourRequest.jobDate = jobDate;
  }
  final int? startTime = jsonConvert.convert<int>(json['start_time']);
  if (startTime != null) {
    tHOALabourDetailLabourRequest.startTime = startTime;
  }
  final int? endTime = jsonConvert.convert<int>(json['end_time']);
  if (endTime != null) {
    tHOALabourDetailLabourRequest.endTime = endTime;
  }
  final String? workingHours = jsonConvert.convert<String>(json['working_hours']);
  if (workingHours != null) {
    tHOALabourDetailLabourRequest.workingHours = workingHours;
  }
  final String? hourlyRate = jsonConvert.convert<String>(json['hourly_rate']);
  if (hourlyRate != null) {
    tHOALabourDetailLabourRequest.hourlyRate = hourlyRate;
  }
  final int? hiringNum = jsonConvert.convert<int>(json['hiring_num']);
  if (hiringNum != null) {
    tHOALabourDetailLabourRequest.hiringNum = hiringNum;
  }
  final int? realNum = jsonConvert.convert<int>(json['real_num']);
  if (realNum != null) {
    tHOALabourDetailLabourRequest.realNum = realNum;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    tHOALabourDetailLabourRequest.status = status;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    tHOALabourDetailLabourRequest.description = description;
  }
  final String? eventName = jsonConvert.convert<String>(json['event_name']);
  if (eventName != null) {
    tHOALabourDetailLabourRequest.eventName = eventName;
  }
  final String? eventType = jsonConvert.convert<String>(json['event_type']);
  if (eventType != null) {
    tHOALabourDetailLabourRequest.eventType = eventType;
  }
  final int? withTyphoid = jsonConvert.convert<int>(json['with_typhoid']);
  if (withTyphoid != null) {
    tHOALabourDetailLabourRequest.withTyphoid = withTyphoid;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    tHOALabourDetailLabourRequest.createdAt = createdAt;
  }
  final String? updatedAt = jsonConvert.convert<String>(json['updated_at']);
  if (updatedAt != null) {
    tHOALabourDetailLabourRequest.updatedAt = updatedAt;
  }
  final int? employmentType = jsonConvert.convert<int>(json['employment_type']);
  if (employmentType != null) {
    tHOALabourDetailLabourRequest.employmentType = employmentType;
  }
  final String? position = jsonConvert.convert<String>(json['position']);
  if (position != null) {
    tHOALabourDetailLabourRequest.position = position;
  }
  final String? passengers = jsonConvert.convert<String>(json['passengers']);
  if (passengers != null) {
    tHOALabourDetailLabourRequest.passengers = passengers;
  }
  final String? estRevenue = jsonConvert.convert<String>(json['est_revenue']);
  if (estRevenue != null) {
    tHOALabourDetailLabourRequest.estRevenue = estRevenue;
  }
  final String? estCost = jsonConvert.convert<String>(json['est_cost']);
  if (estCost != null) {
    tHOALabourDetailLabourRequest.estCost = estCost;
  }
  final String? attUrl = jsonConvert.convert<String>(json['att_url']);
  if (attUrl != null) {
    tHOALabourDetailLabourRequest.attUrl = attUrl;
  }
  final String? deletedAt = jsonConvert.convert<String>(json['deleted_at']);
  if (deletedAt != null) {
    tHOALabourDetailLabourRequest.deletedAt = deletedAt;
  }
  final String? jobTitleId = jsonConvert.convert<String>(json['job_title_id']);
  if (jobTitleId != null) {
    tHOALabourDetailLabourRequest.jobTitleId = jobTitleId;
  }
  final String? preStaffIds = jsonConvert.convert<String>(json['pre_staff_ids']);
  if (preStaffIds != null) {
    tHOALabourDetailLabourRequest.preStaffIds = preStaffIds;
  }
  final int? lastOperator = jsonConvert.convert<int>(json['last_operator']);
  if (lastOperator != null) {
    tHOALabourDetailLabourRequest.lastOperator = lastOperator;
  }
  final String? lastAt = jsonConvert.convert<String>(json['last_at']);
  if (lastAt != null) {
    tHOALabourDetailLabourRequest.lastAt = lastAt;
  }
  final String? positionId = jsonConvert.convert<String>(json['position_id']);
  if (positionId != null) {
    tHOALabourDetailLabourRequest.positionId = positionId;
  }
  final int? sexLimit = jsonConvert.convert<int>(json['sex_limit']);
  if (sexLimit != null) {
    tHOALabourDetailLabourRequest.sexLimit = sexLimit;
  }
  final int? maleLimit = jsonConvert.convert<int>(json['male_limit']);
  if (maleLimit != null) {
    tHOALabourDetailLabourRequest.maleLimit = maleLimit;
  }
  final int? femaleLimit = jsonConvert.convert<int>(json['female_limit']);
  if (femaleLimit != null) {
    tHOALabourDetailLabourRequest.femaleLimit = femaleLimit;
  }
  final int? isOt = jsonConvert.convert<int>(json['is_ot']);
  if (isOt != null) {
    tHOALabourDetailLabourRequest.isOt = isOt;
  }
  return tHOALabourDetailLabourRequest;
}

Map<String, dynamic> $THOALabourDetailLabourRequestToJson(THOALabourDetailLabourRequest entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['employer_id'] = entity.employerId;
  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['event_name'] = entity.eventName;
  data['event_type'] = entity.eventType;
  data['with_typhoid'] = entity.withTyphoid;
  data['created_at'] = entity.createdAt;
  data['updated_at'] = entity.updatedAt;
  data['employment_type'] = entity.employmentType;
  data['position'] = entity.position;
  data['passengers'] = entity.passengers;
  data['est_revenue'] = entity.estRevenue;
  data['est_cost'] = entity.estCost;
  data['att_url'] = entity.attUrl;
  data['deleted_at'] = entity.deletedAt;
  data['job_title_id'] = entity.jobTitleId;
  data['pre_staff_ids'] = entity.preStaffIds;
  data['last_operator'] = entity.lastOperator;
  data['last_at'] = entity.lastAt;
  data['position_id'] = entity.positionId;
  data['sex_limit'] = entity.sexLimit;
  data['male_limit'] = entity.maleLimit;
  data['female_limit'] = entity.femaleLimit;
  data['is_ot'] = entity.isOt;
  return data;
}

extension THOALabourDetailLabourRequestExtension on THOALabourDetailLabourRequest {
  THOALabourDetailLabourRequest copyWith({
    int? id,
    int? employerId,
    int? sourceType,
    int? agencyId,
    String? agencyName,
    String? jobTitle,
    int? outletId,
    String? outletName,
    String? jobDate,
    int? startTime,
    int? endTime,
    String? workingHours,
    String? hourlyRate,
    int? hiringNum,
    int? realNum,
    int? status,
    String? description,
    String? eventName,
    String? eventType,
    int? withTyphoid,
    String? createdAt,
    String? updatedAt,
    int? employmentType,
    String? position,
    String? passengers,
    String? estRevenue,
    String? estCost,
    String? attUrl,
    String? deletedAt,
    String? jobTitleId,
    String? preStaffIds,
    int? lastOperator,
    String? lastAt,
    String? positionId,
    int? sexLimit,
    int? maleLimit,
    int? femaleLimit,
    int? isOt,
  }) {
    return THOALabourDetailLabourRequest()
      ..id = id ?? this.id
      ..employerId = employerId ?? this.employerId
      ..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
      ..eventName = eventName ?? this.eventName
      ..eventType = eventType ?? this.eventType
      ..withTyphoid = withTyphoid ?? this.withTyphoid
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..employmentType = employmentType ?? this.employmentType
      ..position = position ?? this.position
      ..passengers = passengers ?? this.passengers
      ..estRevenue = estRevenue ?? this.estRevenue
      ..estCost = estCost ?? this.estCost
      ..attUrl = attUrl ?? this.attUrl
      ..deletedAt = deletedAt ?? this.deletedAt
      ..jobTitleId = jobTitleId ?? this.jobTitleId
      ..preStaffIds = preStaffIds ?? this.preStaffIds
      ..lastOperator = lastOperator ?? this.lastOperator
      ..lastAt = lastAt ?? this.lastAt
      ..positionId = positionId ?? this.positionId
      ..sexLimit = sexLimit ?? this.sexLimit
      ..maleLimit = maleLimit ?? this.maleLimit
      ..femaleLimit = femaleLimit ?? this.femaleLimit
      ..isOt = isOt ?? this.isOt;
  }
}