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

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

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

extension THPreSelectedStaffTableEntityExtension on THPreSelectedStaffTableEntity {
  THPreSelectedStaffTableEntity copyWith({
    int? total,
    List<THPreSelectedStaffTableRows>? rows,
  }) {
    return THPreSelectedStaffTableEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

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

Map<String, dynamic> $THPreSelectedStaffTableRowsToJson(THPreSelectedStaffTableRows 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;
  return data;
}

extension THPreSelectedStaffTableRowsExtension on THPreSelectedStaffTableRows {
  THPreSelectedStaffTableRows copyWith({
    String? id,
    String? name,
    String? gender,
    String? mobile,
    String? nric,
    String? profilePicture,
    int? status,
    int? applyState,
  }) {
    return THPreSelectedStaffTableRows()
      ..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;
  }
}