import 'package:domain/generated/json/base/json_convert_content.dart';
import 'package:domain/entity/response/labour_request_index_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<LabourRequestIndexStatusList>? statusList = (json['status_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourRequestIndexStatusList>(e) as LabourRequestIndexStatusList).toList();
  if (statusList != null) {
    labourRequestIndexEntity.statusList = statusList;
  }
  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['status_list'] = entity.statusList?.map((v) => v.toJson()).toList();
  return data;
}

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

LabourRequestIndexDepartmentList $LabourRequestIndexDepartmentListFromJson(Map<String, dynamic> json) {
  final LabourRequestIndexDepartmentList labourRequestIndexDepartmentList = LabourRequestIndexDepartmentList();
  final int? value = jsonConvert.convert<int>(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({
    int? 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 int? value = jsonConvert.convert<int>(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({
    int? value,
    String? txt,
    String? selected,
  }) {
    return LabourRequestIndexStatusList()
      ..value = value ?? this.value
      ..txt = txt ?? this.txt
      ..selected = selected ?? this.selected;
  }
}