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

LabourRequestEditIndexEntity $LabourRequestEditIndexEntityFromJson(Map<String, dynamic> json) {
  final LabourRequestEditIndexEntity labourRequestEditIndexEntity = LabourRequestEditIndexEntity();
  final int? requestId = jsonConvert.convert<int>(json['request_id']);
  if (requestId != null) {
    labourRequestEditIndexEntity.requestId = requestId;
  }
  final int? serviceType = jsonConvert.convert<int>(json['service_type']);
  if (serviceType != null) {
    labourRequestEditIndexEntity.serviceType = serviceType;
  }
  final String? jobStart = jsonConvert.convert<String>(json['job_start']);
  if (jobStart != null) {
    labourRequestEditIndexEntity.jobStart = jobStart;
  }
  final String? jobEnd = jsonConvert.convert<String>(json['job_end']);
  if (jobEnd != null) {
    labourRequestEditIndexEntity.jobEnd = jobEnd;
  }
  final String? departmentId = jsonConvert.convert<String>(json['department_id']);
  if (departmentId != null) {
    labourRequestEditIndexEntity.departmentId = departmentId;
  }
  final String? templateId = jsonConvert.convert<String>(json['template_id']);
  if (templateId != null) {
    labourRequestEditIndexEntity.templateId = templateId;
  }
  final int? needNum = jsonConvert.convert<int>(json['need_num']);
  if (needNum != null) {
    labourRequestEditIndexEntity.needNum = needNum;
  }
  final String? amount = jsonConvert.convert<String>(json['amount']);
  if (amount != null) {
    labourRequestEditIndexEntity.amount = amount;
  }
  final List<LabourRequestEditIndexTemplateList>? templateList = (json['template_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourRequestEditIndexTemplateList>(e) as LabourRequestEditIndexTemplateList).toList();
  if (templateList != null) {
    labourRequestEditIndexEntity.templateList = templateList;
  }
  final List<LabourRequestEditIndexDepartmentList>? departmentList = (json['department_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourRequestEditIndexDepartmentList>(e) as LabourRequestEditIndexDepartmentList).toList();
  if (departmentList != null) {
    labourRequestEditIndexEntity.departmentList = departmentList;
  }
  final List<LabourRequestEditIndexDepartmentList>? chargeList = (json['charge_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourRequestEditIndexDepartmentList>(e) as LabourRequestEditIndexDepartmentList).toList();
  if (chargeList != null) {
    labourRequestEditIndexEntity.chargeList = chargeList;
  }
  return labourRequestEditIndexEntity;
}

Map<String, dynamic> $LabourRequestEditIndexEntityToJson(LabourRequestEditIndexEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['request_id'] = entity.requestId;
  data['service_type'] = entity.serviceType;
  data['job_start'] = entity.jobStart;
  data['job_end'] = entity.jobEnd;
  data['department_id'] = entity.departmentId;
  data['template_id'] = entity.templateId;
  data['need_num'] = entity.needNum;
  data['amount'] = entity.amount;
  data['template_list'] = entity.templateList.map((v) => v.toJson()).toList();
  data['department_list'] = entity.departmentList.map((v) => v.toJson()).toList();
  data['charge_list'] = entity.chargeList.map((v) => v.toJson()).toList();
  return data;
}

extension LabourRequestEditIndexEntityExtension on LabourRequestEditIndexEntity {
  LabourRequestEditIndexEntity copyWith({
    int? requestId,
    int? serviceType,
    String? jobStart,
    String? jobEnd,
    String? departmentId,
    String? templateId,
    int? needNum,
    String? amount,
    List<LabourRequestEditIndexTemplateList>? templateList,
    List<LabourRequestEditIndexDepartmentList>? departmentList,
    List<LabourRequestEditIndexDepartmentList>? chargeList,
  }) {
    return LabourRequestEditIndexEntity()
      ..requestId = requestId ?? this.requestId
      ..serviceType = serviceType ?? this.serviceType
      ..jobStart = jobStart ?? this.jobStart
      ..jobEnd = jobEnd ?? this.jobEnd
      ..departmentId = departmentId ?? this.departmentId
      ..templateId = templateId ?? this.templateId
      ..needNum = needNum ?? this.needNum
      ..amount = amount ?? this.amount
      ..templateList = templateList ?? this.templateList
      ..departmentList = departmentList ?? this.departmentList
      ..chargeList = chargeList ?? this.chargeList;
  }
}

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

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

extension LabourRequestEditIndexTemplateListExtension on LabourRequestEditIndexTemplateList {
  LabourRequestEditIndexTemplateList copyWith({
    int? value,
    String? txt,
    String? selected,
  }) {
    return LabourRequestEditIndexTemplateList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..selected = selected ?? this.selected;
  }
}

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

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

extension LabourRequestEditIndexDepartmentListExtension on LabourRequestEditIndexDepartmentList {
  LabourRequestEditIndexDepartmentList copyWith({
    String? value,
    String? txt,
    String? selected,
    String? checked,
  }) {
    return LabourRequestEditIndexDepartmentList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..selected = selected ?? this.selected
      ..checked = checked ?? this.checked;
  }
}