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

THOALabourTableEntity $THOALabourTableEntityFromJson(Map<String, dynamic> json) {
  final THOALabourTableEntity tHOALabourTableEntity = THOALabourTableEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    tHOALabourTableEntity.total = total;
  }
  final List<THOALabourTableRows>? rows = (json['rows'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<THOALabourTableRows>(e) as THOALabourTableRows).toList();
  if (rows != null) {
    tHOALabourTableEntity.rows = rows;
  }
  final int? totNum = jsonConvert.convert<int>(json['tot_num']);
  if (totNum != null) {
    tHOALabourTableEntity.totNum = totNum;
  }
  return tHOALabourTableEntity;
}

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

extension THOALabourTableEntityExtension on THOALabourTableEntity {
  THOALabourTableEntity copyWith({
    int? total,
    List<THOALabourTableRows>? rows,
    int? totNum,
  }) {
    return THOALabourTableEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows
      ..totNum = totNum ?? this.totNum;
  }
}

THOALabourTableRows $THOALabourTableRowsFromJson(Map<String, dynamic> json) {
  final THOALabourTableRows tHOALabourTableRows = THOALabourTableRows();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    tHOALabourTableRows.id = id;
  }
  final String? sourceShow = jsonConvert.convert<String>(json['source_show']);
  if (sourceShow != null) {
    tHOALabourTableRows.sourceShow = sourceShow;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    tHOALabourTableRows.jobDate = jobDate;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    tHOALabourTableRows.outletName = outletName;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    tHOALabourTableRows.jobTitle = jobTitle;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    tHOALabourTableRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    tHOALabourTableRows.endTime = endTime;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    tHOALabourTableRows.status = status;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    tHOALabourTableRows.statusShow = statusShow;
  }
  final String? approveBy = jsonConvert.convert<String>(json['approve_by']);
  if (approveBy != null) {
    tHOALabourTableRows.approveBy = approveBy;
  }
  final int? hiringNum = jsonConvert.convert<int>(json['hiring_num']);
  if (hiringNum != null) {
    tHOALabourTableRows.hiringNum = hiringNum;
  }
  final int? isOt = jsonConvert.convert<int>(json['is_ot']);
  if (isOt != null) {
    tHOALabourTableRows.isOt = isOt;
  }
  final int? preNum = jsonConvert.convert<int>(json['pre_num']);
  if (preNum != null) {
    tHOALabourTableRows.preNum = preNum;
  }
  final int? attNum = jsonConvert.convert<int>(json['att_num']);
  if (attNum != null) {
    tHOALabourTableRows.attNum = attNum;
  }
  final String? lastOperator = jsonConvert.convert<String>(json['last_operator']);
  if (lastOperator != null) {
    tHOALabourTableRows.lastOperator = lastOperator;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    tHOALabourTableRows.createdAt = createdAt;
  }
  final String? positionName = jsonConvert.convert<String>(json['position_name']);
  if (positionName != null) {
    tHOALabourTableRows.positionName = positionName;
  }
  return tHOALabourTableRows;
}

Map<String, dynamic> $THOALabourTableRowsToJson(THOALabourTableRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['source_show'] = entity.sourceShow;
  data['job_date'] = entity.jobDate;
  data['outlet_name'] = entity.outletName;
  data['job_title'] = entity.jobTitle;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['status'] = entity.status;
  data['status_show'] = entity.statusShow;
  data['approve_by'] = entity.approveBy;
  data['hiring_num'] = entity.hiringNum;
  data['is_ot'] = entity.isOt;
  data['pre_num'] = entity.preNum;
  data['att_num'] = entity.attNum;
  data['last_operator'] = entity.lastOperator;
  data['created_at'] = entity.createdAt;
  data['position_name'] = entity.positionName;
  return data;
}

extension THOALabourTableRowsExtension on THOALabourTableRows {
  THOALabourTableRows copyWith({
    String? id,
    String? sourceShow,
    String? jobDate,
    String? outletName,
    String? jobTitle,
    String? startTime,
    String? endTime,
    int? status,
    String? statusShow,
    String? approveBy,
    int? hiringNum,
    int? isOt,
    int? preNum,
    int? attNum,
    String? lastOperator,
    String? createdAt,
    String? positionName,
  }) {
    return THOALabourTableRows()
      ..id = id ?? this.id
      ..sourceShow = sourceShow ?? this.sourceShow
      ..jobDate = jobDate ?? this.jobDate
      ..outletName = outletName ?? this.outletName
      ..jobTitle = jobTitle ?? this.jobTitle
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..status = status ?? this.status
      ..statusShow = statusShow ?? this.statusShow
      ..approveBy = approveBy ?? this.approveBy
      ..hiringNum = hiringNum ?? this.hiringNum
      ..isOt = isOt ?? this.isOt
      ..preNum = preNum ?? this.preNum
      ..attNum = attNum ?? this.attNum
      ..lastOperator = lastOperator ?? this.lastOperator
      ..createdAt = createdAt ?? this.createdAt
      ..positionName = positionName ?? this.positionName;
  }
}