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


UKSecurityAttendanceOptionEntity $UKSecurityAttendanceOptionEntityFromJson(Map<String, dynamic> json) {
  final UKSecurityAttendanceOptionEntity uKSecurityAttendanceOptionEntity = UKSecurityAttendanceOptionEntity();
  final List<IndexOptionEntity>? departmentList = (json['department_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (departmentList != null) {
    uKSecurityAttendanceOptionEntity.departmentList = departmentList;
  }
  final UKSecurityAttendanceOptionFilter? filter = jsonConvert.convert<UKSecurityAttendanceOptionFilter>(json['filter']);
  if (filter != null) {
    uKSecurityAttendanceOptionEntity.filter = filter;
  }
  return uKSecurityAttendanceOptionEntity;
}

Map<String, dynamic> $UKSecurityAttendanceOptionEntityToJson(UKSecurityAttendanceOptionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['department_list'] = entity.departmentList?.map((v) => v.toJson()).toList();
  data['filter'] = entity.filter?.toJson();
  return data;
}

extension UKSecurityAttendanceOptionEntityExtension on UKSecurityAttendanceOptionEntity {
  UKSecurityAttendanceOptionEntity copyWith({
    List<IndexOptionEntity>? departmentList,
    UKSecurityAttendanceOptionFilter? filter,
  }) {
    return UKSecurityAttendanceOptionEntity()
      ..departmentList = departmentList ?? this.departmentList
      ..filter = filter ?? this.filter;
  }
}

UKSecurityAttendanceOptionFilter $UKSecurityAttendanceOptionFilterFromJson(Map<String, dynamic> json) {
  final UKSecurityAttendanceOptionFilter uKSecurityAttendanceOptionFilter = UKSecurityAttendanceOptionFilter();
  final String? startDate = jsonConvert.convert<String>(json['start_date']);
  if (startDate != null) {
    uKSecurityAttendanceOptionFilter.startDate = startDate;
  }
  final String? endDate = jsonConvert.convert<String>(json['end_date']);
  if (endDate != null) {
    uKSecurityAttendanceOptionFilter.endDate = endDate;
  }
  return uKSecurityAttendanceOptionFilter;
}

Map<String, dynamic> $UKSecurityAttendanceOptionFilterToJson(UKSecurityAttendanceOptionFilter entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['start_date'] = entity.startDate;
  data['end_date'] = entity.endDate;
  return data;
}

extension UKSecurityAttendanceOptionFilterExtension on UKSecurityAttendanceOptionFilter {
  UKSecurityAttendanceOptionFilter copyWith({
    String? startDate,
    String? endDate,
  }) {
    return UKSecurityAttendanceOptionFilter()
      ..startDate = startDate ?? this.startDate
      ..endDate = endDate ?? this.endDate;
  }
}