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

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

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

extension SGLabourReviewTableEntityExtension on SGLabourReviewTableEntity {
  SGLabourReviewTableEntity copyWith({
    int? total,
    List<SGLabourReviewTableRows>? rows,
  }) {
    return SGLabourReviewTableEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

SGLabourReviewTableRows $SGLabourReviewTableRowsFromJson(Map<String, dynamic> json) {
  final SGLabourReviewTableRows sGLabourReviewTableRows = SGLabourReviewTableRows();
  final String? recordId = jsonConvert.convert<String>(json['record_id']);
  if (recordId != null) {
    sGLabourReviewTableRows.recordId = recordId;
  }
  final String? orderId = jsonConvert.convert<String>(json['order_id']);
  if (orderId != null) {
    sGLabourReviewTableRows.orderId = orderId;
  }
  final String? requestId = jsonConvert.convert<String>(json['request_id']);
  if (requestId != null) {
    sGLabourReviewTableRows.requestId = requestId;
  }
  final String? source = jsonConvert.convert<String>(json['source']);
  if (source != null) {
    sGLabourReviewTableRows.source = source;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    sGLabourReviewTableRows.statusShow = statusShow;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    sGLabourReviewTableRows.createdAt = createdAt;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    sGLabourReviewTableRows.jobDate = jobDate;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    sGLabourReviewTableRows.outletName = outletName;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    sGLabourReviewTableRows.jobTitle = jobTitle;
  }
  final String? jobTime = jsonConvert.convert<String>(json['job_time']);
  if (jobTime != null) {
    sGLabourReviewTableRows.jobTime = jobTime;
  }
  final String? workingHours = jsonConvert.convert<String>(json['working_hours']);
  if (workingHours != null) {
    sGLabourReviewTableRows.workingHours = workingHours;
  }
  final String? hiringNum = jsonConvert.convert<String>(json['hiring_num']);
  if (hiringNum != null) {
    sGLabourReviewTableRows.hiringNum = hiringNum;
  }
  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
  if (isSelected != null) {
    sGLabourReviewTableRows.isSelected = isSelected;
  }
  return sGLabourReviewTableRows;
}

Map<String, dynamic> $SGLabourReviewTableRowsToJson(SGLabourReviewTableRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['record_id'] = entity.recordId;
  data['order_id'] = entity.orderId;
  data['request_id'] = entity.requestId;
  data['source'] = entity.source;
  data['status_show'] = entity.statusShow;
  data['created_at'] = entity.createdAt;
  data['job_date'] = entity.jobDate;
  data['outlet_name'] = entity.outletName;
  data['job_title'] = entity.jobTitle;
  data['job_time'] = entity.jobTime;
  data['working_hours'] = entity.workingHours;
  data['hiring_num'] = entity.hiringNum;
  data['isSelected'] = entity.isSelected;
  return data;
}

extension SGLabourReviewTableRowsExtension on SGLabourReviewTableRows {
  SGLabourReviewTableRows copyWith({
    String? recordId,
    String? orderId,
    String? requestId,
    String? source,
    String? statusShow,
    String? createdAt,
    String? jobDate,
    String? outletName,
    String? jobTitle,
    String? jobTime,
    String? workingHours,
    String? hiringNum,
    bool? isSelected,
  }) {
    return SGLabourReviewTableRows()
      ..recordId = recordId ?? this.recordId
      ..orderId = orderId ?? this.orderId
      ..requestId = requestId ?? this.requestId
      ..source = source ?? this.source
      ..statusShow = statusShow ?? this.statusShow
      ..createdAt = createdAt ?? this.createdAt
      ..jobDate = jobDate ?? this.jobDate
      ..outletName = outletName ?? this.outletName
      ..jobTitle = jobTitle ?? this.jobTitle
      ..jobTime = jobTime ?? this.jobTime
      ..workingHours = workingHours ?? this.workingHours
      ..hiringNum = hiringNum ?? this.hiringNum
      ..isSelected = isSelected ?? this.isSelected;
  }
}