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


SGLabourRequestAddOptionEntity $SGLabourRequestAddOptionEntityFromJson(Map<String, dynamic> json) {
  final SGLabourRequestAddOptionEntity sGLabourRequestAddOptionEntity = SGLabourRequestAddOptionEntity();
  final List<LabourRequestAgencyEntity>? agencyList = (json['agency_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourRequestAgencyEntity>(e) as LabourRequestAgencyEntity).toList();
  if (agencyList != null) {
    sGLabourRequestAddOptionEntity.agencyList = agencyList;
  }
  final List<IndexOptionEntity>? titleList = (json['title_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (titleList != null) {
    sGLabourRequestAddOptionEntity.titleList = titleList;
  }
  final List<IndexOptionEntity>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (outletList != null) {
    sGLabourRequestAddOptionEntity.outletList = outletList;
  }
  final List<IndexOptionEntity>? limitList = (json['limit_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (limitList != null) {
    sGLabourRequestAddOptionEntity.limitList = limitList;
  }
  final List<IndexOptionEntity>? requestType = (json['request_type'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (requestType != null) {
    sGLabourRequestAddOptionEntity.requestType = requestType;
  }
  final List<IndexOptionEntity>? positionList = (json['position_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (positionList != null) {
    sGLabourRequestAddOptionEntity.positionList = positionList;
  }
  return sGLabourRequestAddOptionEntity;
}

Map<String, dynamic> $SGLabourRequestAddOptionEntityToJson(SGLabourRequestAddOptionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['agency_list'] = entity.agencyList.map((v) => v.toJson()).toList();
  data['title_list'] = entity.titleList.map((v) => v.toJson()).toList();
  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 SGLabourRequestAddOptionEntityExtension on SGLabourRequestAddOptionEntity {
  SGLabourRequestAddOptionEntity copyWith({
    List<LabourRequestAgencyEntity>? agencyList,
    List<IndexOptionEntity>? titleList,
    List<IndexOptionEntity>? outletList,
    List<IndexOptionEntity>? limitList,
    List<IndexOptionEntity>? requestType,
    List<IndexOptionEntity>? positionList,
  }) {
    return SGLabourRequestAddOptionEntity()
      ..agencyList = agencyList ?? this.agencyList
      ..titleList = titleList ?? this.titleList
      ..outletList = outletList ?? this.outletList
      ..limitList = limitList ?? this.limitList
      ..requestType = requestType ?? this.requestType
      ..positionList = positionList ?? this.positionList;
  }
}

LabourRequestAgencyEntity $LabourRequestAgencyEntityFromJson(Map<String, dynamic> json) {
  final LabourRequestAgencyEntity labourRequestAgencyEntity = LabourRequestAgencyEntity();
  final String? agencyId = jsonConvert.convert<String>(json['agency_id']);
  if (agencyId != null) {
    labourRequestAgencyEntity.agencyId = agencyId;
  }
  final String? agencyName = jsonConvert.convert<String>(json['agency_name']);
  if (agencyName != null) {
    labourRequestAgencyEntity.agencyName = agencyName;
  }
  return labourRequestAgencyEntity;
}

Map<String, dynamic> $LabourRequestAgencyEntityToJson(LabourRequestAgencyEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['agency_id'] = entity.agencyId;
  data['agency_name'] = entity.agencyName;
  return data;
}

extension LabourRequestAgencyEntityExtension on LabourRequestAgencyEntity {
  LabourRequestAgencyEntity copyWith({
    String? agencyId,
    String? agencyName,
  }) {
    return LabourRequestAgencyEntity()
      ..agencyId = agencyId ?? this.agencyId
      ..agencyName = agencyName ?? this.agencyName;
  }
}