import 'package:domain/generated/json/base/json_convert_content.dart';
import 'package:domain/entity/response/u_k_report_attendance_entity.dart';
import 'package:domain/entity/response/u_k_attendance_entity.dart';


UKReportAttendanceEntity $UKReportAttendanceEntityFromJson(Map<String, dynamic> json) {
  final UKReportAttendanceEntity uKReportAttendanceEntity = UKReportAttendanceEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    uKReportAttendanceEntity.total = total;
  }
  final List<UKReportAttendanceRows>? rows = (json['rows'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<UKReportAttendanceRows>(e) as UKReportAttendanceRows).toList();
  if (rows != null) {
    uKReportAttendanceEntity.rows = rows;
  }
  return uKReportAttendanceEntity;
}

Map<String, dynamic> $UKReportAttendanceEntityToJson(UKReportAttendanceEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['rows'] = entity.rows.map((v) => v.toJson()).toList();
  return data;
}

extension UKReportAttendanceEntityExtension on UKReportAttendanceEntity {
  UKReportAttendanceEntity copyWith({
    int? total,
    List<UKReportAttendanceRows>? rows,
  }) {
    return UKReportAttendanceEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

UKReportAttendanceRows $UKReportAttendanceRowsFromJson(Map<String, dynamic> json) {
  final UKReportAttendanceRows uKReportAttendanceRows = UKReportAttendanceRows();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    uKReportAttendanceRows.id = id;
  }
  final String? staffName = jsonConvert.convert<String>(json['staff_name']);
  if (staffName != null) {
    uKReportAttendanceRows.staffName = staffName;
  }
  final String? icNo = jsonConvert.convert<String>(json['ic_no']);
  if (icNo != null) {
    uKReportAttendanceRows.icNo = icNo;
  }
  final String? departmentName = jsonConvert.convert<String>(json['department_name']);
  if (departmentName != null) {
    uKReportAttendanceRows.departmentName = departmentName;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    uKReportAttendanceRows.jobDate = jobDate;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    uKReportAttendanceRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    uKReportAttendanceRows.endTime = endTime;
  }
  final String? adjustShow = jsonConvert.convert<String>(json['adjust_show']);
  if (adjustShow != null) {
    uKReportAttendanceRows.adjustShow = adjustShow;
  }
  final String? totalShow = jsonConvert.convert<String>(json['total_show']);
  if (totalShow != null) {
    uKReportAttendanceRows.totalShow = totalShow;
  }
  final UKAttendanceInOut? workIn = jsonConvert.convert<UKAttendanceInOut>(json['work_in']);
  if (workIn != null) {
    uKReportAttendanceRows.workIn = workIn;
  }
  final UKAttendanceInOut? workOut = jsonConvert.convert<UKAttendanceInOut>(json['work_out']);
  if (workOut != null) {
    uKReportAttendanceRows.workOut = workOut;
  }
  final int? wIn = jsonConvert.convert<int>(json['w_in']);
  if (wIn != null) {
    uKReportAttendanceRows.wIn = wIn;
  }
  final int? wOut = jsonConvert.convert<int>(json['w_out']);
  if (wOut != null) {
    uKReportAttendanceRows.wOut = wOut;
  }
  final String? reviseHours = jsonConvert.convert<String>(json['revise_hours']);
  if (reviseHours != null) {
    uKReportAttendanceRows.reviseHours = reviseHours;
  }
  return uKReportAttendanceRows;
}

Map<String, dynamic> $UKReportAttendanceRowsToJson(UKReportAttendanceRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['staff_name'] = entity.staffName;
  data['ic_no'] = entity.icNo;
  data['department_name'] = entity.departmentName;
  data['job_date'] = entity.jobDate;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['adjust_show'] = entity.adjustShow;
  data['total_show'] = entity.totalShow;
  data['work_in'] = entity.workIn?.toJson();
  data['work_out'] = entity.workOut?.toJson();
  data['w_in'] = entity.wIn;
  data['w_out'] = entity.wOut;
  data['revise_hours'] = entity.reviseHours;
  return data;
}

extension UKReportAttendanceRowsExtension on UKReportAttendanceRows {
  UKReportAttendanceRows copyWith({
    String? id,
    String? staffName,
    String? icNo,
    String? departmentName,
    String? jobDate,
    String? startTime,
    String? endTime,
    String? adjustShow,
    String? totalShow,
    UKAttendanceInOut? workIn,
    UKAttendanceInOut? workOut,
    int? wIn,
    int? wOut,
    String? reviseHours,
  }) {
    return UKReportAttendanceRows()
      ..id = id ?? this.id
      ..staffName = staffName ?? this.staffName
      ..icNo = icNo ?? this.icNo
      ..departmentName = departmentName ?? this.departmentName
      ..jobDate = jobDate ?? this.jobDate
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..adjustShow = adjustShow ?? this.adjustShow
      ..totalShow = totalShow ?? this.totalShow
      ..workIn = workIn ?? this.workIn
      ..workOut = workOut ?? this.workOut
      ..wIn = wIn ?? this.wIn
      ..wOut = wOut ?? this.wOut
      ..reviseHours = reviseHours ?? this.reviseHours;
  }
}