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

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

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

extension JobListAppliedStaffSearchEntityExtension on JobListAppliedStaffSearchEntity {
  JobListAppliedStaffSearchEntity copyWith({
    int? total,
    List<JobListAppliedStaffSearchRows>? rows,
  }) {
    return JobListAppliedStaffSearchEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

JobListAppliedStaffSearchRows $JobListAppliedStaffSearchRowsFromJson(Map<String, dynamic> json) {
  final JobListAppliedStaffSearchRows jobListAppliedStaffSearchRows = JobListAppliedStaffSearchRows();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    jobListAppliedStaffSearchRows.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    jobListAppliedStaffSearchRows.name = name;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    jobListAppliedStaffSearchRows.sex = sex;
  }
  final String? phone = jsonConvert.convert<String>(json['phone']);
  if (phone != null) {
    jobListAppliedStaffSearchRows.phone = phone;
  }
  final String? nric = jsonConvert.convert<String>(json['nric']);
  if (nric != null) {
    jobListAppliedStaffSearchRows.nric = nric;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    jobListAppliedStaffSearchRows.avatar = avatar;
  }
  final int? applyState = jsonConvert.convert<int>(json['apply_state']);
  if (applyState != null) {
    jobListAppliedStaffSearchRows.applyState = applyState;
  }
  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
  if (isSelected != null) {
    jobListAppliedStaffSearchRows.isSelected = isSelected;
  }
  return jobListAppliedStaffSearchRows;
}

Map<String, dynamic> $JobListAppliedStaffSearchRowsToJson(JobListAppliedStaffSearchRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['sex'] = entity.sex;
  data['phone'] = entity.phone;
  data['nric'] = entity.nric;
  data['avatar'] = entity.avatar;
  data['apply_state'] = entity.applyState;
  data['isSelected'] = entity.isSelected;
  return data;
}

extension JobListAppliedStaffSearchRowsExtension on JobListAppliedStaffSearchRows {
  JobListAppliedStaffSearchRows copyWith({
    int? id,
    String? name,
    String? sex,
    String? phone,
    String? nric,
    String? avatar,
    int? applyState,
    bool? isSelected,
  }) {
    return JobListAppliedStaffSearchRows()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..sex = sex ?? this.sex
      ..phone = phone ?? this.phone
      ..nric = nric ?? this.nric
      ..avatar = avatar ?? this.avatar
      ..applyState = applyState ?? this.applyState
      ..isSelected = isSelected ?? this.isSelected;
  }
}