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

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

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

extension LabourListEREntityExtension on LabourListEREntity {
  LabourListEREntity copyWith({
    int? total,
    List<LabourListERRows>? rows,
  }) {
    return LabourListEREntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

LabourListERRows $LabourListERRowsFromJson(Map<String, dynamic> json) {
  final LabourListERRows labourListERRows = LabourListERRows();
  final String? jobId = jsonConvert.convert<String>(json['job_id']);
  if (jobId != null) {
    labourListERRows.jobId = jobId;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    labourListERRows.jobDate = jobDate;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    labourListERRows.outletName = outletName;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    labourListERRows.jobTitle = jobTitle;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    labourListERRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    labourListERRows.endTime = endTime;
  }
  final String? hiringNum = jsonConvert.convert<String>(json['hiring_num']);
  if (hiringNum != null) {
    labourListERRows.hiringNum = hiringNum;
  }
  final String? preNum = jsonConvert.convert<String>(json['pre_num']);
  if (preNum != null) {
    labourListERRows.preNum = preNum;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    labourListERRows.status = status;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    labourListERRows.statusShow = statusShow;
  }
  final int? isOt = jsonConvert.convert<int>(json['is_ot']);
  if (isOt != null) {
    labourListERRows.isOt = isOt;
  }
  final List<String>? actionList = (json['action_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (actionList != null) {
    labourListERRows.actionList = actionList;
  }
  return labourListERRows;
}

Map<String, dynamic> $LabourListERRowsToJson(LabourListERRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['job_id'] = entity.jobId;
  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['hiring_num'] = entity.hiringNum;
  data['pre_num'] = entity.preNum;
  data['status'] = entity.status;
  data['status_show'] = entity.statusShow;
  data['is_ot'] = entity.isOt;
  data['action_list'] = entity.actionList;
  return data;
}

extension LabourListERRowsExtension on LabourListERRows {
  LabourListERRows copyWith({
    String? jobId,
    String? jobDate,
    String? outletName,
    String? jobTitle,
    String? startTime,
    String? endTime,
    String? hiringNum,
    String? preNum,
    int? status,
    String? statusShow,
    int? isOt,
    List<String>? actionList,
  }) {
    return LabourListERRows()
      ..jobId = jobId ?? this.jobId
      ..jobDate = jobDate ?? this.jobDate
      ..outletName = outletName ?? this.outletName
      ..jobTitle = jobTitle ?? this.jobTitle
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..hiringNum = hiringNum ?? this.hiringNum
      ..preNum = preNum ?? this.preNum
      ..status = status ?? this.status
      ..statusShow = statusShow ?? this.statusShow
      ..isOt = isOt ?? this.isOt
      ..actionList = actionList ?? this.actionList;
  }
}