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

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

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

extension THAppliedTableEntityExtension on THAppliedTableEntity {
  THAppliedTableEntity copyWith({
    int? total,
    List<THAppliedTableRows>? rows,
  }) {
    return THAppliedTableEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

THAppliedTableRows $THAppliedTableRowsFromJson(Map<String, dynamic> json) {
  final THAppliedTableRows tHAppliedTableRows = THAppliedTableRows();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    tHAppliedTableRows.id = id;
  }
  final String? memberId = jsonConvert.convert<String>(json['member_id']);
  if (memberId != null) {
    tHAppliedTableRows.memberId = memberId;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    tHAppliedTableRows.avatar = avatar;
  }
  final String? sId = jsonConvert.convert<String>(json['s_id']);
  if (sId != null) {
    tHAppliedTableRows.sId = sId;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    tHAppliedTableRows.jobTitle = jobTitle;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    tHAppliedTableRows.outletName = outletName;
  }
  final String? ballroomName = jsonConvert.convert<String>(json['ballroom_name']);
  if (ballroomName != null) {
    tHAppliedTableRows.ballroomName = ballroomName;
  }
  final String? labourerName = jsonConvert.convert<String>(json['labourer_name']);
  if (labourerName != null) {
    tHAppliedTableRows.labourerName = labourerName;
  }
  final String? labourerNric = jsonConvert.convert<String>(json['labourer_nric']);
  if (labourerNric != null) {
    tHAppliedTableRows.labourerNric = labourerNric;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    tHAppliedTableRows.jobDate = jobDate;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    tHAppliedTableRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    tHAppliedTableRows.endTime = endTime;
  }
  final String? adjustHours = jsonConvert.convert<String>(json['adjust_hours']);
  if (adjustHours != null) {
    tHAppliedTableRows.adjustHours = adjustHours;
  }
  final String? workingHours = jsonConvert.convert<String>(json['working_hours']);
  if (workingHours != null) {
    tHAppliedTableRows.workingHours = workingHours;
  }
  final String? totalHours = jsonConvert.convert<String>(json['total_hours']);
  if (totalHours != null) {
    tHAppliedTableRows.totalHours = totalHours;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    tHAppliedTableRows.status = status;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    tHAppliedTableRows.statusShow = statusShow;
  }
  final String? hourlyRate = jsonConvert.convert<String>(json['hourly_rate']);
  if (hourlyRate != null) {
    tHAppliedTableRows.hourlyRate = hourlyRate;
  }
  final String? remarkStatus = jsonConvert.convert<String>(json['remark_status']);
  if (remarkStatus != null) {
    tHAppliedTableRows.remarkStatus = remarkStatus;
  }
  final THAppliedTableCheckInOut? securityIn = jsonConvert.convert<THAppliedTableCheckInOut>(json['security_in']);
  if (securityIn != null) {
    tHAppliedTableRows.securityIn = securityIn;
  }
  final THAppliedTableCheckInOut? securityOut = jsonConvert.convert<THAppliedTableCheckInOut>(json['security_out']);
  if (securityOut != null) {
    tHAppliedTableRows.securityOut = securityOut;
  }
  final THAppliedTableCheckInOut? workIn = jsonConvert.convert<THAppliedTableCheckInOut>(json['work_in']);
  if (workIn != null) {
    tHAppliedTableRows.workIn = workIn;
  }
  final THAppliedTableCheckInOut? workOut = jsonConvert.convert<THAppliedTableCheckInOut>(json['work_out']);
  if (workOut != null) {
    tHAppliedTableRows.workOut = workOut;
  }
  final String? sIn = jsonConvert.convert<String>(json['s_in']);
  if (sIn != null) {
    tHAppliedTableRows.sIn = sIn;
  }
  final String? sOut = jsonConvert.convert<String>(json['s_out']);
  if (sOut != null) {
    tHAppliedTableRows.sOut = sOut;
  }
  final String? wIn = jsonConvert.convert<String>(json['w_in']);
  if (wIn != null) {
    tHAppliedTableRows.wIn = wIn;
  }
  final String? wOut = jsonConvert.convert<String>(json['w_out']);
  if (wOut != null) {
    tHAppliedTableRows.wOut = wOut;
  }
  final String? auditReject = jsonConvert.convert<String>(json['audit_reject']);
  if (auditReject != null) {
    tHAppliedTableRows.auditReject = auditReject;
  }
  final String? reviseHours = jsonConvert.convert<String>(json['revise_hours']);
  if (reviseHours != null) {
    tHAppliedTableRows.reviseHours = reviseHours;
  }
  final String? clothingSize = jsonConvert.convert<String>(json['clothing_size']);
  if (clothingSize != null) {
    tHAppliedTableRows.clothingSize = clothingSize;
  }
  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
  if (isSelected != null) {
    tHAppliedTableRows.isSelected = isSelected;
  }
  return tHAppliedTableRows;
}

Map<String, dynamic> $THAppliedTableRowsToJson(THAppliedTableRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['member_id'] = entity.memberId;
  data['avatar'] = entity.avatar;
  data['s_id'] = entity.sId;
  data['job_title'] = entity.jobTitle;
  data['outlet_name'] = entity.outletName;
  data['ballroom_name'] = entity.ballroomName;
  data['labourer_name'] = entity.labourerName;
  data['labourer_nric'] = entity.labourerNric;
  data['job_date'] = entity.jobDate;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['adjust_hours'] = entity.adjustHours;
  data['working_hours'] = entity.workingHours;
  data['total_hours'] = entity.totalHours;
  data['status'] = entity.status;
  data['status_show'] = entity.statusShow;
  data['hourly_rate'] = entity.hourlyRate;
  data['remark_status'] = entity.remarkStatus;
  data['security_in'] = entity.securityIn?.toJson();
  data['security_out'] = entity.securityOut?.toJson();
  data['work_in'] = entity.workIn?.toJson();
  data['work_out'] = entity.workOut?.toJson();
  data['s_in'] = entity.sIn;
  data['s_out'] = entity.sOut;
  data['w_in'] = entity.wIn;
  data['w_out'] = entity.wOut;
  data['audit_reject'] = entity.auditReject;
  data['revise_hours'] = entity.reviseHours;
  data['clothing_size'] = entity.clothingSize;
  data['isSelected'] = entity.isSelected;
  return data;
}

extension THAppliedTableRowsExtension on THAppliedTableRows {
  THAppliedTableRows copyWith({
    String? id,
    String? memberId,
    String? avatar,
    String? sId,
    String? jobTitle,
    String? outletName,
    String? ballroomName,
    String? labourerName,
    String? labourerNric,
    String? jobDate,
    String? startTime,
    String? endTime,
    String? adjustHours,
    String? workingHours,
    String? totalHours,
    int? status,
    String? statusShow,
    String? hourlyRate,
    String? remarkStatus,
    THAppliedTableCheckInOut? securityIn,
    THAppliedTableCheckInOut? securityOut,
    THAppliedTableCheckInOut? workIn,
    THAppliedTableCheckInOut? workOut,
    String? sIn,
    String? sOut,
    String? wIn,
    String? wOut,
    String? auditReject,
    String? reviseHours,
    String? clothingSize,
    bool? isSelected,
  }) {
    return THAppliedTableRows()
      ..id = id ?? this.id
      ..memberId = memberId ?? this.memberId
      ..avatar = avatar ?? this.avatar
      ..sId = sId ?? this.sId
      ..jobTitle = jobTitle ?? this.jobTitle
      ..outletName = outletName ?? this.outletName
      ..ballroomName = ballroomName ?? this.ballroomName
      ..labourerName = labourerName ?? this.labourerName
      ..labourerNric = labourerNric ?? this.labourerNric
      ..jobDate = jobDate ?? this.jobDate
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..adjustHours = adjustHours ?? this.adjustHours
      ..workingHours = workingHours ?? this.workingHours
      ..totalHours = totalHours ?? this.totalHours
      ..status = status ?? this.status
      ..statusShow = statusShow ?? this.statusShow
      ..hourlyRate = hourlyRate ?? this.hourlyRate
      ..remarkStatus = remarkStatus ?? this.remarkStatus
      ..securityIn = securityIn ?? this.securityIn
      ..securityOut = securityOut ?? this.securityOut
      ..workIn = workIn ?? this.workIn
      ..workOut = workOut ?? this.workOut
      ..sIn = sIn ?? this.sIn
      ..sOut = sOut ?? this.sOut
      ..wIn = wIn ?? this.wIn
      ..wOut = wOut ?? this.wOut
      ..auditReject = auditReject ?? this.auditReject
      ..reviseHours = reviseHours ?? this.reviseHours
      ..clothingSize = clothingSize ?? this.clothingSize
      ..isSelected = isSelected ?? this.isSelected;
  }
}

THAppliedTableCheckInOut $THAppliedTableCheckInOutFromJson(Map<String, dynamic> json) {
  final THAppliedTableCheckInOut tHAppliedTableCheckInOut = THAppliedTableCheckInOut();
  final String? time = jsonConvert.convert<String>(json['time']);
  if (time != null) {
    tHAppliedTableCheckInOut.time = time;
  }
  final String? temp = jsonConvert.convert<String>(json['temp']);
  if (temp != null) {
    tHAppliedTableCheckInOut.temp = temp;
  }
  final String? image = jsonConvert.convert<String>(json['image']);
  if (image != null) {
    tHAppliedTableCheckInOut.image = image;
  }
  final int? changed = jsonConvert.convert<int>(json['changed']);
  if (changed != null) {
    tHAppliedTableCheckInOut.changed = changed;
  }
  return tHAppliedTableCheckInOut;
}

Map<String, dynamic> $THAppliedTableCheckInOutToJson(THAppliedTableCheckInOut entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['time'] = entity.time;
  data['temp'] = entity.temp;
  data['image'] = entity.image;
  data['changed'] = entity.changed;
  return data;
}

extension THAppliedTableCheckInOutExtension on THAppliedTableCheckInOut {
  THAppliedTableCheckInOut copyWith({
    String? time,
    String? temp,
    String? image,
    int? changed,
  }) {
    return THAppliedTableCheckInOut()
      ..time = time ?? this.time
      ..temp = temp ?? this.temp
      ..image = image ?? this.image
      ..changed = changed ?? this.changed;
  }
}