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

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

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

extension THPreSelectedTableEntityExtension on THPreSelectedTableEntity {
  THPreSelectedTableEntity copyWith({
    int? total,
    List<THPreSelectedTableRows>? rows,
  }) {
    return THPreSelectedTableEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

THPreSelectedTableRows $THPreSelectedTableRowsFromJson(Map<String, dynamic> json) {
  final THPreSelectedTableRows tHPreSelectedTableRows = THPreSelectedTableRows();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    tHPreSelectedTableRows.id = id;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    tHPreSelectedTableRows.statusShow = statusShow;
  }
  final String? message = jsonConvert.convert<String>(json['message']);
  if (message != null) {
    tHPreSelectedTableRows.message = message;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    tHPreSelectedTableRows.name = name;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    tHPreSelectedTableRows.sex = sex;
  }
  final String? nric = jsonConvert.convert<String>(json['nric']);
  if (nric != null) {
    tHPreSelectedTableRows.nric = nric;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    tHPreSelectedTableRows.avatar = avatar;
  }
  return tHPreSelectedTableRows;
}

Map<String, dynamic> $THPreSelectedTableRowsToJson(THPreSelectedTableRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['status_show'] = entity.statusShow;
  data['message'] = entity.message;
  data['name'] = entity.name;
  data['sex'] = entity.sex;
  data['nric'] = entity.nric;
  data['avatar'] = entity.avatar;
  return data;
}

extension THPreSelectedTableRowsExtension on THPreSelectedTableRows {
  THPreSelectedTableRows copyWith({
    String? id,
    String? statusShow,
    String? message,
    String? name,
    String? sex,
    String? nric,
    String? avatar,
  }) {
    return THPreSelectedTableRows()
      ..id = id ?? this.id
      ..statusShow = statusShow ?? this.statusShow
      ..message = message ?? this.message
      ..name = name ?? this.name
      ..sex = sex ?? this.sex
      ..nric = nric ?? this.nric
      ..avatar = avatar ?? this.avatar;
  }
}