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

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

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

extension ReviseListSGEntityExtension on ReviseListSGEntity {
  ReviseListSGEntity copyWith({
    int? total,
    List<ReviseListSGRows>? rows,
  }) {
    return ReviseListSGEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

ReviseListSGRows $ReviseListSGRowsFromJson(Map<String, dynamic> json) {
  final ReviseListSGRows reviseListSGRows = ReviseListSGRows();
  final String? reviseId = jsonConvert.convert<String>(json['revise_id']);
  if (reviseId != null) {
    reviseListSGRows.reviseId = reviseId;
  }
  final String? reviseHours = jsonConvert.convert<String>(json['revise_hours']);
  if (reviseHours != null) {
    reviseListSGRows.reviseHours = reviseHours;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    reviseListSGRows.name = name;
  }
  final String? nric = jsonConvert.convert<String>(json['nric']);
  if (nric != null) {
    reviseListSGRows.nric = nric;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    reviseListSGRows.jobDate = jobDate;
  }
  final String? jobTime = jsonConvert.convert<String>(json['job_time']);
  if (jobTime != null) {
    reviseListSGRows.jobTime = jobTime;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    reviseListSGRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    reviseListSGRows.endTime = endTime;
  }
  final String? adjustHours = jsonConvert.convert<String>(json['adjust_hours']);
  if (adjustHours != null) {
    reviseListSGRows.adjustHours = adjustHours;
  }
  final String? totalHours = jsonConvert.convert<String>(json['total_hours']);
  if (totalHours != null) {
    reviseListSGRows.totalHours = totalHours;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    reviseListSGRows.status = status;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    reviseListSGRows.statusShow = statusShow;
  }
  final List<String>? actionList = (json['action_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (actionList != null) {
    reviseListSGRows.actionList = actionList;
  }
  return reviseListSGRows;
}

Map<String, dynamic> $ReviseListSGRowsToJson(ReviseListSGRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['revise_id'] = entity.reviseId;
  data['revise_hours'] = entity.reviseHours;
  data['name'] = entity.name;
  data['nric'] = entity.nric;
  data['job_date'] = entity.jobDate;
  data['job_time'] = entity.jobTime;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['adjust_hours'] = entity.adjustHours;
  data['total_hours'] = entity.totalHours;
  data['status'] = entity.status;
  data['status_show'] = entity.statusShow;
  data['action_list'] = entity.actionList;
  return data;
}

extension ReviseListSGRowsExtension on ReviseListSGRows {
  ReviseListSGRows copyWith({
    String? reviseId,
    String? reviseHours,
    String? name,
    String? nric,
    String? jobDate,
    String? jobTime,
    String? startTime,
    String? endTime,
    String? adjustHours,
    String? totalHours,
    int? status,
    String? statusShow,
    List<String>? actionList,
  }) {
    return ReviseListSGRows()
      ..reviseId = reviseId ?? this.reviseId
      ..reviseHours = reviseHours ?? this.reviseHours
      ..name = name ?? this.name
      ..nric = nric ?? this.nric
      ..jobDate = jobDate ?? this.jobDate
      ..jobTime = jobTime ?? this.jobTime
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..adjustHours = adjustHours ?? this.adjustHours
      ..totalHours = totalHours ?? this.totalHours
      ..status = status ?? this.status
      ..statusShow = statusShow ?? this.statusShow
      ..actionList = actionList ?? this.actionList;
  }
}