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

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

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

extension THAppliedEmployeeEntityExtension on THAppliedEmployeeEntity {
  THAppliedEmployeeEntity copyWith({
    int? total,
    List<THAppliedEmployeeRows>? rows,
  }) {
    return THAppliedEmployeeEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

THAppliedEmployeeRows $THAppliedEmployeeRowsFromJson(Map<String, dynamic> json) {
  final THAppliedEmployeeRows tHAppliedEmployeeRows = THAppliedEmployeeRows();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    tHAppliedEmployeeRows.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    tHAppliedEmployeeRows.name = name;
  }
  final String? gender = jsonConvert.convert<String>(json['gender']);
  if (gender != null) {
    tHAppliedEmployeeRows.gender = gender;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    tHAppliedEmployeeRows.mobile = mobile;
  }
  final String? nric = jsonConvert.convert<String>(json['nric']);
  if (nric != null) {
    tHAppliedEmployeeRows.nric = nric;
  }
  final String? profilePicture = jsonConvert.convert<String>(json['profile_picture']);
  if (profilePicture != null) {
    tHAppliedEmployeeRows.profilePicture = profilePicture;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    tHAppliedEmployeeRows.status = status;
  }
  final int? applyState = jsonConvert.convert<int>(json['apply_state']);
  if (applyState != null) {
    tHAppliedEmployeeRows.applyState = applyState;
  }
  final bool? isSelected = jsonConvert.convert<bool>(json['isSelected']);
  if (isSelected != null) {
    tHAppliedEmployeeRows.isSelected = isSelected;
  }
  return tHAppliedEmployeeRows;
}

Map<String, dynamic> $THAppliedEmployeeRowsToJson(THAppliedEmployeeRows 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['isSelected'] = entity.isSelected;
  return data;
}

extension THAppliedEmployeeRowsExtension on THAppliedEmployeeRows {
  THAppliedEmployeeRows copyWith({
    String? id,
    String? name,
    String? gender,
    String? mobile,
    String? nric,
    String? profilePicture,
    int? status,
    int? applyState,
    bool? isSelected,
  }) {
    return THAppliedEmployeeRows()
      ..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
      ..isSelected = isSelected ?? this.isSelected;
  }
}