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


SGLabourRequestOptionEntity $SGLabourRequestOptionEntityFromJson(Map<String, dynamic> json) {
  final SGLabourRequestOptionEntity sGLabourRequestOptionEntity = SGLabourRequestOptionEntity();
  final String? outletId = jsonConvert.convert<String>(json['outlet_id']);
  if (outletId != null) {
    sGLabourRequestOptionEntity.outletId = outletId;
  }
  final String? startDate = jsonConvert.convert<String>(json['start_date']);
  if (startDate != null) {
    sGLabourRequestOptionEntity.startDate = startDate;
  }
  final String? endDate = jsonConvert.convert<String>(json['end_date']);
  if (endDate != null) {
    sGLabourRequestOptionEntity.endDate = endDate;
  }
  final List<IndexOptionEntity>? agencyList = (json['agency_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (agencyList != null) {
    sGLabourRequestOptionEntity.agencyList = agencyList;
  }
  final List<IndexOptionEntity>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (outletList != null) {
    sGLabourRequestOptionEntity.outletList = outletList;
  }
  final List<IndexOptionEntity>? statusList = (json['status_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (statusList != null) {
    sGLabourRequestOptionEntity.statusList = statusList;
  }
  return sGLabourRequestOptionEntity;
}

Map<String, dynamic> $SGLabourRequestOptionEntityToJson(SGLabourRequestOptionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['outlet_id'] = entity.outletId;
  data['start_date'] = entity.startDate;
  data['end_date'] = entity.endDate;
  data['agency_list'] = entity.agencyList.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();
  return data;
}

extension SGLabourRequestOptionEntityExtension on SGLabourRequestOptionEntity {
  SGLabourRequestOptionEntity copyWith({
    String? outletId,
    String? startDate,
    String? endDate,
    List<IndexOptionEntity>? agencyList,
    List<IndexOptionEntity>? outletList,
    List<IndexOptionEntity>? statusList,
  }) {
    return SGLabourRequestOptionEntity()
      ..outletId = outletId ?? this.outletId
      ..startDate = startDate ?? this.startDate
      ..endDate = endDate ?? this.endDate
      ..agencyList = agencyList ?? this.agencyList
      ..outletList = outletList ?? this.outletList
      ..statusList = statusList ?? this.statusList;
  }
}