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

StaffDetailEntity $StaffDetailEntityFromJson(Map<String, dynamic> json) {
  final StaffDetailEntity staffDetailEntity = StaffDetailEntity();
  final int? memberId = jsonConvert.convert<int>(json['member_id']);
  if (memberId != null) {
    staffDetailEntity.memberId = memberId;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    staffDetailEntity.name = name;
  }
  final String? avatar = jsonConvert.convert<String>(json['avatar']);
  if (avatar != null) {
    staffDetailEntity.avatar = avatar;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    staffDetailEntity.sex = sex;
  }
  final String? dob = jsonConvert.convert<String>(json['dob']);
  if (dob != null) {
    staffDetailEntity.dob = dob;
  }
  final String? nric = jsonConvert.convert<String>(json['nric']);
  if (nric != null) {
    staffDetailEntity.nric = nric;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    staffDetailEntity.mobile = mobile;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    staffDetailEntity.email = email;
  }
  final String? address = jsonConvert.convert<String>(json['address']);
  if (address != null) {
    staffDetailEntity.address = address;
  }
  final String? natl = jsonConvert.convert<String>(json['natl']);
  if (natl != null) {
    staffDetailEntity.natl = natl;
  }
  final String? lang = jsonConvert.convert<String>(json['lang']);
  if (lang != null) {
    staffDetailEntity.lang = lang;
  }
  final String? emerName = jsonConvert.convert<String>(json['emer_name']);
  if (emerName != null) {
    staffDetailEntity.emerName = emerName;
  }
  final String? emerPhone = jsonConvert.convert<String>(json['emer_phone']);
  if (emerPhone != null) {
    staffDetailEntity.emerPhone = emerPhone;
  }
  final int? remNum = jsonConvert.convert<int>(json['rem_num']);
  if (remNum != null) {
    staffDetailEntity.remNum = remNum;
  }
  final double? remRate = jsonConvert.convert<double>(json['rem_rate']);
  if (remRate != null) {
    staffDetailEntity.remRate = remRate;
  }
  return staffDetailEntity;
}

Map<String, dynamic> $StaffDetailEntityToJson(StaffDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['member_id'] = entity.memberId;
  data['name'] = entity.name;
  data['avatar'] = entity.avatar;
  data['sex'] = entity.sex;
  data['dob'] = entity.dob;
  data['nric'] = entity.nric;
  data['mobile'] = entity.mobile;
  data['email'] = entity.email;
  data['address'] = entity.address;
  data['natl'] = entity.natl;
  data['lang'] = entity.lang;
  data['emer_name'] = entity.emerName;
  data['emer_phone'] = entity.emerPhone;
  data['rem_num'] = entity.remNum;
  data['rem_rate'] = entity.remRate;
  return data;
}

extension StaffDetailEntityExtension on StaffDetailEntity {
  StaffDetailEntity copyWith({
    int? memberId,
    String? name,
    String? avatar,
    String? sex,
    String? dob,
    String? nric,
    String? mobile,
    String? email,
    String? address,
    String? natl,
    String? lang,
    String? emerName,
    String? emerPhone,
    int? remNum,
    double? remRate,
  }) {
    return StaffDetailEntity()
      ..memberId = memberId ?? this.memberId
      ..name = name ?? this.name
      ..avatar = avatar ?? this.avatar
      ..sex = sex ?? this.sex
      ..dob = dob ?? this.dob
      ..nric = nric ?? this.nric
      ..mobile = mobile ?? this.mobile
      ..email = email ?? this.email
      ..address = address ?? this.address
      ..natl = natl ?? this.natl
      ..lang = lang ?? this.lang
      ..emerName = emerName ?? this.emerName
      ..emerPhone = emerPhone ?? this.emerPhone
      ..remNum = remNum ?? this.remNum
      ..remRate = remRate ?? this.remRate;
  }
}