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


LabourRequestIndexEntity $LabourRequestIndexEntityFromJson(Map<String, dynamic> json) {
  final LabourRequestIndexEntity labourRequestIndexEntity = LabourRequestIndexEntity();
  final List<LabourRequestIndexDepartmentList>? departmentList = (json['department_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourRequestIndexDepartmentList>(e) as LabourRequestIndexDepartmentList).toList();
  if (departmentList != null) {
    labourRequestIndexEntity.departmentList = departmentList;
  }
  final List<LabourRequestIndexDepartmentList>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourRequestIndexDepartmentList>(e) as LabourRequestIndexDepartmentList).toList();
  if (outletList != null) {
    labourRequestIndexEntity.outletList = outletList;
  }
  final List<LabourRequestIndexStatusList>? statusList = (json['status_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourRequestIndexStatusList>(e) as LabourRequestIndexStatusList).toList();
  if (statusList != null) {
    labourRequestIndexEntity.statusList = statusList;
  }
  final List<IndexOptionEntity>? divisionList = (json['division_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (divisionList != null) {
    labourRequestIndexEntity.divisionList = divisionList;
  }
  return labourRequestIndexEntity;
}

Map<String, dynamic> $LabourRequestIndexEntityToJson(LabourRequestIndexEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['department_list'] = entity.departmentList?.map((v) => v.toJson()).toList();
  data['outlet_list'] = entity.outletList?.map((v) => v.toJson()).toList();
  data['status_list'] = entity.statusList?.map((v) => v.toJson()).toList();
  data['division_list'] = entity.divisionList.map((v) => v.toJson()).toList();
  return data;
}

extension LabourRequestIndexEntityExtension on LabourRequestIndexEntity {
  LabourRequestIndexEntity copyWith({
    List<LabourRequestIndexDepartmentList>? departmentList,
    List<LabourRequestIndexDepartmentList>? outletList,
    List<LabourRequestIndexStatusList>? statusList,
    List<IndexOptionEntity>? divisionList,
  }) {
    return LabourRequestIndexEntity()
      ..departmentList = departmentList ?? this.departmentList
      ..outletList = outletList ?? this.outletList
      ..statusList = statusList ?? this.statusList
      ..divisionList = divisionList ?? this.divisionList;
  }
}

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

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

extension LabourRequestIndexDepartmentListExtension on LabourRequestIndexDepartmentList {
  LabourRequestIndexDepartmentList copyWith({
    String? value,
    String? txt,
    String? selected,
  }) {
    return LabourRequestIndexDepartmentList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..selected = selected ?? this.selected;
  }
}

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

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

extension LabourRequestIndexStatusListExtension on LabourRequestIndexStatusList {
  LabourRequestIndexStatusList copyWith({
    String? value,
    String? txt,
    String? selected,
  }) {
    return LabourRequestIndexStatusList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..selected = selected ?? this.selected;
  }
}