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

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

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

extension SGLabourRequestTableEntityExtension on SGLabourRequestTableEntity {
  SGLabourRequestTableEntity copyWith({
    int? total,
    List<SGLabourRequestTableRows>? rows,
  }) {
    return SGLabourRequestTableEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

SGLabourRequestTableRows $SGLabourRequestTableRowsFromJson(Map<String, dynamic> json) {
  final SGLabourRequestTableRows sGLabourRequestTableRows = SGLabourRequestTableRows();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    sGLabourRequestTableRows.id = id;
  }
  final String? source = jsonConvert.convert<String>(json['source']);
  if (source != null) {
    sGLabourRequestTableRows.source = source;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    sGLabourRequestTableRows.jobDate = jobDate;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    sGLabourRequestTableRows.outletName = outletName;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    sGLabourRequestTableRows.jobTitle = jobTitle;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    sGLabourRequestTableRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    sGLabourRequestTableRows.endTime = endTime;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    sGLabourRequestTableRows.status = status;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    sGLabourRequestTableRows.statusShow = statusShow;
  }
  final String? hiringNum = jsonConvert.convert<String>(json['hiring_num']);
  if (hiringNum != null) {
    sGLabourRequestTableRows.hiringNum = hiringNum;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    sGLabourRequestTableRows.createdAt = createdAt;
  }
  final List<String>? actionList = (json['action_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (actionList != null) {
    sGLabourRequestTableRows.actionList = actionList;
  }
  return sGLabourRequestTableRows;
}

Map<String, dynamic> $SGLabourRequestTableRowsToJson(SGLabourRequestTableRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['source'] = entity.source;
  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['hiring_num'] = entity.hiringNum;
  data['created_at'] = entity.createdAt;
  data['action_list'] = entity.actionList;
  return data;
}

extension SGLabourRequestTableRowsExtension on SGLabourRequestTableRows {
  SGLabourRequestTableRows copyWith({
    String? id,
    String? source,
    String? jobDate,
    String? outletName,
    String? jobTitle,
    String? startTime,
    String? endTime,
    int? status,
    String? statusShow,
    String? hiringNum,
    String? createdAt,
    List<String>? actionList,
  }) {
    return SGLabourRequestTableRows()
      ..id = id ?? this.id
      ..source = source ?? this.source
      ..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
      ..hiringNum = hiringNum ?? this.hiringNum
      ..createdAt = createdAt ?? this.createdAt
      ..actionList = actionList ?? this.actionList;
  }
}