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

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

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

extension UKReportWorkingHoursEntityExtension on UKReportWorkingHoursEntity {
  UKReportWorkingHoursEntity copyWith({
    int? total,
    List<UKReportWorkingHoursRows>? rows,
  }) {
    return UKReportWorkingHoursEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

UKReportWorkingHoursRows $UKReportWorkingHoursRowsFromJson(Map<String, dynamic> json) {
  final UKReportWorkingHoursRows uKReportWorkingHoursRows = UKReportWorkingHoursRows();
  final String? jobId = jsonConvert.convert<String>(json['job_id']);
  if (jobId != null) {
    uKReportWorkingHoursRows.jobId = jobId;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    uKReportWorkingHoursRows.jobDate = jobDate;
  }
  final String? departmentName = jsonConvert.convert<String>(json['department_name']);
  if (departmentName != null) {
    uKReportWorkingHoursRows.departmentName = departmentName;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    uKReportWorkingHoursRows.jobTitle = jobTitle;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    uKReportWorkingHoursRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    uKReportWorkingHoursRows.endTime = endTime;
  }
  final String? completeNum = jsonConvert.convert<String>(json['complete_num']);
  if (completeNum != null) {
    uKReportWorkingHoursRows.completeNum = completeNum;
  }
  final String? workingHours = jsonConvert.convert<String>(json['working_hours']);
  if (workingHours != null) {
    uKReportWorkingHoursRows.workingHours = workingHours;
  }
  return uKReportWorkingHoursRows;
}

Map<String, dynamic> $UKReportWorkingHoursRowsToJson(UKReportWorkingHoursRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['job_id'] = entity.jobId;
  data['job_date'] = entity.jobDate;
  data['department_name'] = entity.departmentName;
  data['job_title'] = entity.jobTitle;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['complete_num'] = entity.completeNum;
  data['working_hours'] = entity.workingHours;
  return data;
}

extension UKReportWorkingHoursRowsExtension on UKReportWorkingHoursRows {
  UKReportWorkingHoursRows copyWith({
    String? jobId,
    String? jobDate,
    String? departmentName,
    String? jobTitle,
    String? startTime,
    String? endTime,
    String? completeNum,
    String? workingHours,
  }) {
    return UKReportWorkingHoursRows()
      ..jobId = jobId ?? this.jobId
      ..jobDate = jobDate ?? this.jobDate
      ..departmentName = departmentName ?? this.departmentName
      ..jobTitle = jobTitle ?? this.jobTitle
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..completeNum = completeNum ?? this.completeNum
      ..workingHours = workingHours ?? this.workingHours;
  }
}