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

StaffDetailSGEntity $StaffDetailSGEntityFromJson(Map<String, dynamic> json) {
  final StaffDetailSGEntity staffDetailSGEntity = StaffDetailSGEntity();
  final String? memberId = jsonConvert.convert<String>(json['member_id']);
  if (memberId != null) {
    staffDetailSGEntity.memberId = memberId;
  }
  final String? workerName = jsonConvert.convert<String>(json['worker_name']);
  if (workerName != null) {
    staffDetailSGEntity.workerName = workerName;
  }
  final String? mobile = jsonConvert.convert<String>(json['mobile']);
  if (mobile != null) {
    staffDetailSGEntity.mobile = mobile;
  }
  final String? icon = jsonConvert.convert<String>(json['icon']);
  if (icon != null) {
    staffDetailSGEntity.icon = icon;
  }
  final String? sex = jsonConvert.convert<String>(json['sex']);
  if (sex != null) {
    staffDetailSGEntity.sex = sex;
  }
  final String? nric = jsonConvert.convert<String>(json['nric']);
  if (nric != null) {
    staffDetailSGEntity.nric = nric;
  }
  final String? hourlyRate = jsonConvert.convert<String>(json['hourly_rate']);
  if (hourlyRate != null) {
    staffDetailSGEntity.hourlyRate = hourlyRate;
  }
  final StaffDetailSGReviews? reviews = jsonConvert.convert<StaffDetailSGReviews>(json['reviews']);
  if (reviews != null) {
    staffDetailSGEntity.reviews = reviews;
  }
  final int? hotelStaff = jsonConvert.convert<int>(json['hotel_staff']);
  if (hotelStaff != null) {
    staffDetailSGEntity.hotelStaff = hotelStaff;
  }
  final int? salaryStructure = jsonConvert.convert<int>(json['salary_structure']);
  if (salaryStructure != null) {
    staffDetailSGEntity.salaryStructure = salaryStructure;
  }
  final int? showStar = jsonConvert.convert<int>(json['show_star']);
  if (showStar != null) {
    staffDetailSGEntity.showStar = showStar;
  }
  return staffDetailSGEntity;
}

Map<String, dynamic> $StaffDetailSGEntityToJson(StaffDetailSGEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['member_id'] = entity.memberId;
  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['reviews'] = entity.reviews?.toJson();
  data['hotel_staff'] = entity.hotelStaff;
  data['salary_structure'] = entity.salaryStructure;
  data['show_star'] = entity.showStar;
  return data;
}

extension StaffDetailSGEntityExtension on StaffDetailSGEntity {
  StaffDetailSGEntity copyWith({
    String? memberId,
    String? workerName,
    String? mobile,
    String? icon,
    String? sex,
    String? nric,
    String? hourlyRate,
    StaffDetailSGReviews? reviews,
    int? hotelStaff,
    int? salaryStructure,
    int? showStar,
  }) {
    return StaffDetailSGEntity()
      ..memberId = memberId ?? this.memberId
      ..workerName = workerName ?? this.workerName
      ..mobile = mobile ?? this.mobile
      ..icon = icon ?? this.icon
      ..sex = sex ?? this.sex
      ..nric = nric ?? this.nric
      ..hourlyRate = hourlyRate ?? this.hourlyRate
      ..reviews = reviews ?? this.reviews
      ..hotelStaff = hotelStaff ?? this.hotelStaff
      ..salaryStructure = salaryStructure ?? this.salaryStructure
      ..showStar = showStar ?? this.showStar;
  }
}

StaffDetailSGReviews $StaffDetailSGReviewsFromJson(Map<String, dynamic> json) {
  final StaffDetailSGReviews staffDetailSGReviews = StaffDetailSGReviews();
  final int? count = jsonConvert.convert<int>(json['count']);
  if (count != null) {
    staffDetailSGReviews.count = count;
  }
  final String? avgScore = jsonConvert.convert<String>(json['avg_score']);
  if (avgScore != null) {
    staffDetailSGReviews.avgScore = avgScore;
  }
  final List<StaffDetailSGReviewsReviews>? reviews = (json['reviews'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<StaffDetailSGReviewsReviews>(e) as StaffDetailSGReviewsReviews).toList();
  if (reviews != null) {
    staffDetailSGReviews.reviews = reviews;
  }
  return staffDetailSGReviews;
}

Map<String, dynamic> $StaffDetailSGReviewsToJson(StaffDetailSGReviews entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['count'] = entity.count;
  data['avg_score'] = entity.avgScore;
  data['reviews'] = entity.reviews?.map((v) => v.toJson()).toList();
  return data;
}

extension StaffDetailSGReviewsExtension on StaffDetailSGReviews {
  StaffDetailSGReviews copyWith({
    int? count,
    String? avgScore,
    List<StaffDetailSGReviewsReviews>? reviews,
  }) {
    return StaffDetailSGReviews()
      ..count = count ?? this.count
      ..avgScore = avgScore ?? this.avgScore
      ..reviews = reviews ?? this.reviews;
  }
}

StaffDetailSGReviewsReviews $StaffDetailSGReviewsReviewsFromJson(Map<String, dynamic> json) {
  final StaffDetailSGReviewsReviews staffDetailSGReviewsReviews = StaffDetailSGReviewsReviews();
  final String? employerName = jsonConvert.convert<String>(json['employer_name']);
  if (employerName != null) {
    staffDetailSGReviewsReviews.employerName = employerName;
  }
  final String? attitudeRate = jsonConvert.convert<String>(json['attitude_rate']);
  if (attitudeRate != null) {
    staffDetailSGReviewsReviews.attitudeRate = attitudeRate;
  }
  final String? groomingRate = jsonConvert.convert<String>(json['grooming_rate']);
  if (groomingRate != null) {
    staffDetailSGReviewsReviews.groomingRate = groomingRate;
  }
  final String? performanceRate = jsonConvert.convert<String>(json['performance_rate']);
  if (performanceRate != null) {
    staffDetailSGReviewsReviews.performanceRate = performanceRate;
  }
  final String? experienceRate = jsonConvert.convert<String>(json['experience_rate']);
  if (experienceRate != null) {
    staffDetailSGReviewsReviews.experienceRate = experienceRate;
  }
  final String? feedback = jsonConvert.convert<String>(json['feedback']);
  if (feedback != null) {
    staffDetailSGReviewsReviews.feedback = feedback;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    staffDetailSGReviewsReviews.createdAt = createdAt;
  }
  return staffDetailSGReviewsReviews;
}

Map<String, dynamic> $StaffDetailSGReviewsReviewsToJson(StaffDetailSGReviewsReviews entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['employer_name'] = entity.employerName;
  data['attitude_rate'] = entity.attitudeRate;
  data['grooming_rate'] = entity.groomingRate;
  data['performance_rate'] = entity.performanceRate;
  data['experience_rate'] = entity.experienceRate;
  data['feedback'] = entity.feedback;
  data['created_at'] = entity.createdAt;
  return data;
}

extension StaffDetailSGReviewsReviewsExtension on StaffDetailSGReviewsReviews {
  StaffDetailSGReviewsReviews copyWith({
    String? employerName,
    String? attitudeRate,
    String? groomingRate,
    String? performanceRate,
    String? experienceRate,
    String? feedback,
    String? createdAt,
  }) {
    return StaffDetailSGReviewsReviews()
      ..employerName = employerName ?? this.employerName
      ..attitudeRate = attitudeRate ?? this.attitudeRate
      ..groomingRate = groomingRate ?? this.groomingRate
      ..performanceRate = performanceRate ?? this.performanceRate
      ..experienceRate = experienceRate ?? this.experienceRate
      ..feedback = feedback ?? this.feedback
      ..createdAt = createdAt ?? this.createdAt;
  }
}