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

THEmployeeDetailEntity $THEmployeeDetailEntityFromJson(Map<String, dynamic> json) {
  final THEmployeeDetailEntity tHEmployeeDetailEntity = THEmployeeDetailEntity();
  final String? memberId = jsonConvert.convert<String>(json['member_id']);
  if (memberId != null) {
    tHEmployeeDetailEntity.memberId = memberId;
  }
  final String? staffId = jsonConvert.convert<String>(json['staff_id']);
  if (staffId != null) {
    tHEmployeeDetailEntity.staffId = staffId;
  }
  final THEmployeeDetailStaff? staff = jsonConvert.convert<THEmployeeDetailStaff>(json['staff']);
  if (staff != null) {
    tHEmployeeDetailEntity.staff = staff;
  }
  final String? workerName = jsonConvert.convert<String>(json['worker_name']);
  if (workerName != null) {
    tHEmployeeDetailEntity.workerName = workerName;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    tHEmployeeDetailEntity.mobile = mobile;
  }
  final String? icon = jsonConvert.convert<String>(json['icon']);
  if (icon != null) {
    tHEmployeeDetailEntity.icon = icon;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    tHEmployeeDetailEntity.sex = sex;
  }
  final String? nric = jsonConvert.convert<String>(json['nric']);
  if (nric != null) {
    tHEmployeeDetailEntity.nric = nric;
  }
  final String? hourlyRate = jsonConvert.convert<String>(json['hourly_rate']);
  if (hourlyRate != null) {
    tHEmployeeDetailEntity.hourlyRate = hourlyRate;
  }
  final String? clothingSize = jsonConvert.convert<String>(json['clothing_size']);
  if (clothingSize != null) {
    tHEmployeeDetailEntity.clothingSize = clothingSize;
  }
  final THEmployeeDetailReviews? reviews = jsonConvert.convert<THEmployeeDetailReviews>(json['reviews']);
  if (reviews != null) {
    tHEmployeeDetailEntity.reviews = reviews;
  }
  return tHEmployeeDetailEntity;
}

Map<String, dynamic> $THEmployeeDetailEntityToJson(THEmployeeDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['member_id'] = entity.memberId;
  data['staff_id'] = entity.staffId;
  data['staff'] = entity.staff?.toJson();
  data['worker_name'] = entity.workerName;
  data['mobile'] = entity.mobile;
  data['icon'] = entity.icon;
  data['sex'] = entity.sex;
  data['nric'] = entity.nric;
  data['hourly_rate'] = entity.hourlyRate;
  data['clothing_size'] = entity.clothingSize;
  data['reviews'] = entity.reviews?.toJson();
  return data;
}

extension THEmployeeDetailEntityExtension on THEmployeeDetailEntity {
  THEmployeeDetailEntity copyWith({
    String? memberId,
    String? staffId,
    THEmployeeDetailStaff? staff,
    String? workerName,
    String? mobile,
    String? icon,
    String? sex,
    String? nric,
    String? hourlyRate,
    String? clothingSize,
    THEmployeeDetailReviews? reviews,
  }) {
    return THEmployeeDetailEntity()
      ..memberId = memberId ?? this.memberId
      ..staffId = staffId ?? this.staffId
      ..staff = staff ?? this.staff
      ..workerName = workerName ?? this.workerName
      ..mobile = mobile ?? this.mobile
      ..icon = icon ?? this.icon
      ..sex = sex ?? this.sex
      ..nric = nric ?? this.nric
      ..hourlyRate = hourlyRate ?? this.hourlyRate
      ..clothingSize = clothingSize ?? this.clothingSize
      ..reviews = reviews ?? this.reviews;
  }
}

THEmployeeDetailStaff $THEmployeeDetailStaffFromJson(Map<String, dynamic> json) {
  final THEmployeeDetailStaff tHEmployeeDetailStaff = THEmployeeDetailStaff();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    tHEmployeeDetailStaff.id = id;
  }
  final String? name = jsonConvert.convert<String>(json['name']);
  if (name != null) {
    tHEmployeeDetailStaff.name = name;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    tHEmployeeDetailStaff.sex = sex;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    tHEmployeeDetailStaff.mobile = mobile;
  }
  final String? nric = jsonConvert.convert<String>(json['nric']);
  if (nric != null) {
    tHEmployeeDetailStaff.nric = nric;
  }
  final String? profilePicture = jsonConvert.convert<String>(json['profile_picture']);
  if (profilePicture != null) {
    tHEmployeeDetailStaff.profilePicture = profilePicture;
  }
  final String? visitorKey = jsonConvert.convert<String>(json['visitor_key']);
  if (visitorKey != null) {
    tHEmployeeDetailStaff.visitorKey = visitorKey;
  }
  final String? yyMemberId = jsonConvert.convert<String>(json['yy_member_id']);
  if (yyMemberId != null) {
    tHEmployeeDetailStaff.yyMemberId = yyMemberId;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    tHEmployeeDetailStaff.createdAt = createdAt;
  }
  final String? updatedAt = jsonConvert.convert<String>(json['updated_at']);
  if (updatedAt != null) {
    tHEmployeeDetailStaff.updatedAt = updatedAt;
  }
  final String? password = jsonConvert.convert<String>(json['password']);
  if (password != null) {
    tHEmployeeDetailStaff.password = password;
  }
  final String? defaultStaff = jsonConvert.convert<String>(json['default_staff']);
  if (defaultStaff != null) {
    tHEmployeeDetailStaff.defaultStaff = defaultStaff;
  }
  final String? typhoidDate = jsonConvert.convert<String>(json['typhoid_date']);
  if (typhoidDate != null) {
    tHEmployeeDetailStaff.typhoidDate = typhoidDate;
  }
  final String? typhoidFile = jsonConvert.convert<String>(json['typhoid_file']);
  if (typhoidFile != null) {
    tHEmployeeDetailStaff.typhoidFile = typhoidFile;
  }
  final String? foodHygiene = jsonConvert.convert<String>(json['food_hygiene']);
  if (foodHygiene != null) {
    tHEmployeeDetailStaff.foodHygiene = foodHygiene;
  }
  final String? criminalFile = jsonConvert.convert<String>(json['criminal_file']);
  if (criminalFile != null) {
    tHEmployeeDetailStaff.criminalFile = criminalFile;
  }
  final String? criminalDate = jsonConvert.convert<String>(json['criminal_date']);
  if (criminalDate != null) {
    tHEmployeeDetailStaff.criminalDate = criminalDate;
  }
  final String? email = jsonConvert.convert<String>(json['email']);
  if (email != null) {
    tHEmployeeDetailStaff.email = email;
  }
  final String? ownStaffId = jsonConvert.convert<String>(json['own_staff_id']);
  if (ownStaffId != null) {
    tHEmployeeDetailStaff.ownStaffId = ownStaffId;
  }
  final String? clothingSize = jsonConvert.convert<String>(json['clothing_size']);
  if (clothingSize != null) {
    tHEmployeeDetailStaff.clothingSize = clothingSize;
  }
  return tHEmployeeDetailStaff;
}

Map<String, dynamic> $THEmployeeDetailStaffToJson(THEmployeeDetailStaff entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['name'] = entity.name;
  data['sex'] = entity.sex;
  data['mobile'] = entity.mobile;
  data['nric'] = entity.nric;
  data['profile_picture'] = entity.profilePicture;
  data['visitor_key'] = entity.visitorKey;
  data['yy_member_id'] = entity.yyMemberId;
  data['created_at'] = entity.createdAt;
  data['updated_at'] = entity.updatedAt;
  data['password'] = entity.password;
  data['default_staff'] = entity.defaultStaff;
  data['typhoid_date'] = entity.typhoidDate;
  data['typhoid_file'] = entity.typhoidFile;
  data['food_hygiene'] = entity.foodHygiene;
  data['criminal_file'] = entity.criminalFile;
  data['criminal_date'] = entity.criminalDate;
  data['email'] = entity.email;
  data['own_staff_id'] = entity.ownStaffId;
  data['clothing_size'] = entity.clothingSize;
  return data;
}

extension THEmployeeDetailStaffExtension on THEmployeeDetailStaff {
  THEmployeeDetailStaff copyWith({
    String? id,
    String? name,
    String? sex,
    String? mobile,
    String? nric,
    String? profilePicture,
    String? visitorKey,
    String? yyMemberId,
    String? createdAt,
    String? updatedAt,
    String? password,
    String? defaultStaff,
    String? typhoidDate,
    String? typhoidFile,
    String? foodHygiene,
    String? criminalFile,
    String? criminalDate,
    String? email,
    String? ownStaffId,
    String? clothingSize,
  }) {
    return THEmployeeDetailStaff()
      ..id = id ?? this.id
      ..name = name ?? this.name
      ..sex = sex ?? this.sex
      ..mobile = mobile ?? this.mobile
      ..nric = nric ?? this.nric
      ..profilePicture = profilePicture ?? this.profilePicture
      ..visitorKey = visitorKey ?? this.visitorKey
      ..yyMemberId = yyMemberId ?? this.yyMemberId
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..password = password ?? this.password
      ..defaultStaff = defaultStaff ?? this.defaultStaff
      ..typhoidDate = typhoidDate ?? this.typhoidDate
      ..typhoidFile = typhoidFile ?? this.typhoidFile
      ..foodHygiene = foodHygiene ?? this.foodHygiene
      ..criminalFile = criminalFile ?? this.criminalFile
      ..criminalDate = criminalDate ?? this.criminalDate
      ..email = email ?? this.email
      ..ownStaffId = ownStaffId ?? this.ownStaffId
      ..clothingSize = clothingSize ?? this.clothingSize;
  }
}

THEmployeeDetailReviews $THEmployeeDetailReviewsFromJson(Map<String, dynamic> json) {
  final THEmployeeDetailReviews tHEmployeeDetailReviews = THEmployeeDetailReviews();
  final String? count = jsonConvert.convert<String>(json['count']);
  if (count != null) {
    tHEmployeeDetailReviews.count = count;
  }
  final String? avgScore = jsonConvert.convert<String>(json['avg_score']);
  if (avgScore != null) {
    tHEmployeeDetailReviews.avgScore = avgScore;
  }
  return tHEmployeeDetailReviews;
}

Map<String, dynamic> $THEmployeeDetailReviewsToJson(THEmployeeDetailReviews entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['count'] = entity.count;
  data['avg_score'] = entity.avgScore;
  return data;
}

extension THEmployeeDetailReviewsExtension on THEmployeeDetailReviews {
  THEmployeeDetailReviews copyWith({
    String? count,
    String? avgScore,
  }) {
    return THEmployeeDetailReviews()
      ..count = count ?? this.count
      ..avgScore = avgScore ?? this.avgScore;
  }
}