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

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

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

extension JobAppliedStaffSGEntityExtension on JobAppliedStaffSGEntity {
  JobAppliedStaffSGEntity copyWith({
    int? total,
    List<JobAppliedStaffSGRows>? rows,
  }) {
    return JobAppliedStaffSGEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

JobAppliedStaffSGRows $JobAppliedStaffSGRowsFromJson(Map<String, dynamic> json) {
  final JobAppliedStaffSGRows jobAppliedStaffSGRows = JobAppliedStaffSGRows();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    jobAppliedStaffSGRows.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    jobAppliedStaffSGRows.name = name;
  }
  final String? gender = jsonConvert.convert<String>(json['gender']);
  if (gender != null) {
    jobAppliedStaffSGRows.gender = gender;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    jobAppliedStaffSGRows.mobile = mobile;
  }
  final String? nric = jsonConvert.convert<String>(json['nric']);
  if (nric != null) {
    jobAppliedStaffSGRows.nric = nric;
  }
  final String? profilePicture = jsonConvert.convert<String>(json['profile_picture']);
  if (profilePicture != null) {
    jobAppliedStaffSGRows.profilePicture = profilePicture;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    jobAppliedStaffSGRows.status = status;
  }
  final int? applyState = jsonConvert.convert<int>(json['apply_state']);
  if (applyState != null) {
    jobAppliedStaffSGRows.applyState = applyState;
  }
  final int? hotelStaff = jsonConvert.convert<int>(json['hotel_staff']);
  if (hotelStaff != null) {
    jobAppliedStaffSGRows.hotelStaff = hotelStaff;
  }
  final int? salaryStructure = jsonConvert.convert<int>(json['salary_structure']);
  if (salaryStructure != null) {
    jobAppliedStaffSGRows.salaryStructure = salaryStructure;
  }
  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
  if (isSelected != null) {
    jobAppliedStaffSGRows.isSelected = isSelected;
  }
  return jobAppliedStaffSGRows;
}

Map<String, dynamic> $JobAppliedStaffSGRowsToJson(JobAppliedStaffSGRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['gender'] = entity.gender;
  data['mobile'] = entity.mobile;
  data['nric'] = entity.nric;
  data['profile_picture'] = entity.profilePicture;
  data['status'] = entity.status;
  data['apply_state'] = entity.applyState;
  data['hotel_staff'] = entity.hotelStaff;
  data['salary_structure'] = entity.salaryStructure;
  data['isSelected'] = entity.isSelected;
  return data;
}

extension JobAppliedStaffSGRowsExtension on JobAppliedStaffSGRows {
  JobAppliedStaffSGRows copyWith({
    String? id,
    String? name,
    String? gender,
    String? mobile,
    String? nric,
    String? profilePicture,
    int? status,
    int? applyState,
    int? hotelStaff,
    int? salaryStructure,
    bool? isSelected,
  }) {
    return JobAppliedStaffSGRows()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..gender = gender ?? this.gender
      ..mobile = mobile ?? this.mobile
      ..nric = nric ?? this.nric
      ..profilePicture = profilePicture ?? this.profilePicture
      ..status = status ?? this.status
      ..applyState = applyState ?? this.applyState
      ..hotelStaff = hotelStaff ?? this.hotelStaff
      ..salaryStructure = salaryStructure ?? this.salaryStructure
      ..isSelected = isSelected ?? this.isSelected;
  }
}