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

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

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

extension LabourReviewListEntityExtension on LabourReviewListEntity {
  LabourReviewListEntity copyWith({
    int? total,
    List<LabourReviewListRows>? rows,
  }) {
    return LabourReviewListEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

LabourReviewListRows $LabourReviewListRowsFromJson(Map<String, dynamic> json) {
  final LabourReviewListRows labourReviewListRows = LabourReviewListRows();
  final String? recordId = jsonConvert.convert<String>(json['record_id']);
  if (recordId != null) {
    labourReviewListRows.recordId = recordId;
  }
  final String? requestId = jsonConvert.convert<String>(json['request_id']);
  if (requestId != null) {
    labourReviewListRows.requestId = requestId;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    labourReviewListRows.jobTitle = jobTitle;
  }
  final String? jobTime = jsonConvert.convert<String>(json['job_time']);
  if (jobTime != null) {
    labourReviewListRows.jobTime = jobTime;
  }
  final String? departmentName = jsonConvert.convert<String>(json['department_name']);
  if (departmentName != null) {
    labourReviewListRows.departmentName = departmentName;
  }
  final String? salaryShow = jsonConvert.convert<String>(json['salary_show']);
  if (salaryShow != null) {
    labourReviewListRows.salaryShow = salaryShow;
  }
  final String? needNum = jsonConvert.convert<String>(json['need_num']);
  if (needNum != null) {
    labourReviewListRows.needNum = needNum;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    labourReviewListRows.statusShow = statusShow;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    labourReviewListRows.createdAt = createdAt;
  }
  final List<String>? btnList = (json['btn_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (btnList != null) {
    labourReviewListRows.btnList = btnList;
  }
  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
  if (isSelected != null) {
    labourReviewListRows.isSelected = isSelected;
  }
  return labourReviewListRows;
}

Map<String, dynamic> $LabourReviewListRowsToJson(LabourReviewListRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['record_id'] = entity.recordId;
  data['request_id'] = entity.requestId;
  data['job_title'] = entity.jobTitle;
  data['job_time'] = entity.jobTime;
  data['department_name'] = entity.departmentName;
  data['salary_show'] = entity.salaryShow;
  data['need_num'] = entity.needNum;
  data['status_show'] = entity.statusShow;
  data['created_at'] = entity.createdAt;
  data['btn_list'] = entity.btnList;
  data['isSelected'] = entity.isSelected;
  return data;
}

extension LabourReviewListRowsExtension on LabourReviewListRows {
  LabourReviewListRows copyWith({
    String? recordId,
    String? requestId,
    String? jobTitle,
    String? jobTime,
    String? departmentName,
    String? salaryShow,
    String? needNum,
    String? statusShow,
    String? createdAt,
    List<String>? btnList,
    bool? isSelected,
  }) {
    return LabourReviewListRows()
      ..recordId = recordId ?? this.recordId
      ..requestId = requestId ?? this.requestId
      ..jobTitle = jobTitle ?? this.jobTitle
      ..jobTime = jobTime ?? this.jobTime
      ..departmentName = departmentName ?? this.departmentName
      ..salaryShow = salaryShow ?? this.salaryShow
      ..needNum = needNum ?? this.needNum
      ..statusShow = statusShow ?? this.statusShow
      ..createdAt = createdAt ?? this.createdAt
      ..btnList = btnList ?? this.btnList
      ..isSelected = isSelected ?? this.isSelected;
  }
}