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


SGLabourReviewOptionEntity $SGLabourReviewOptionEntityFromJson(Map<String, dynamic> json) {
  final SGLabourReviewOptionEntity sGLabourReviewOptionEntity = SGLabourReviewOptionEntity();
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    sGLabourReviewOptionEntity.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    sGLabourReviewOptionEntity.endTime = endTime;
  }
  final List<IndexOptionEntity>? sourceList = (json['source_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (sourceList != null) {
    sGLabourReviewOptionEntity.sourceList = sourceList;
  }
  final List<IndexOptionEntity>? outletList = (json['outlet_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (outletList != null) {
    sGLabourReviewOptionEntity.outletList = outletList;
  }
  return sGLabourReviewOptionEntity;
}

Map<String, dynamic> $SGLabourReviewOptionEntityToJson(SGLabourReviewOptionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['source_list'] = entity.sourceList.map((v) => v.toJson()).toList();
  data['outlet_list'] = entity.outletList.map((v) => v.toJson()).toList();
  return data;
}

extension SGLabourReviewOptionEntityExtension on SGLabourReviewOptionEntity {
  SGLabourReviewOptionEntity copyWith({
    String? startTime,
    String? endTime,
    List<IndexOptionEntity>? sourceList,
    List<IndexOptionEntity>? outletList,
  }) {
    return SGLabourReviewOptionEntity()
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..sourceList = sourceList ?? this.sourceList
      ..outletList = outletList ?? this.outletList;
  }
}