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

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

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

extension StaffRemarkHistoryEntityExtension on StaffRemarkHistoryEntity {
  StaffRemarkHistoryEntity copyWith({
    int? total,
    List<StaffRemarkHistoryRows>? rows,
  }) {
    return StaffRemarkHistoryEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

StaffRemarkHistoryRows $StaffRemarkHistoryRowsFromJson(Map<String, dynamic> json) {
  final StaffRemarkHistoryRows staffRemarkHistoryRows = StaffRemarkHistoryRows();
  final String? company = jsonConvert.convert<String>(json['company']);
  if (company != null) {
    staffRemarkHistoryRows.company = company;
  }
  final double? attitudeRate = jsonConvert.convert<double>(json['attitude_rate']);
  if (attitudeRate != null) {
    staffRemarkHistoryRows.attitudeRate = attitudeRate;
  }
  final double? groomingRate = jsonConvert.convert<double>(json['grooming_rate']);
  if (groomingRate != null) {
    staffRemarkHistoryRows.groomingRate = groomingRate;
  }
  final double? performanceRate = jsonConvert.convert<double>(json['performance_rate']);
  if (performanceRate != null) {
    staffRemarkHistoryRows.performanceRate = performanceRate;
  }
  final double? experienceRate = jsonConvert.convert<double>(json['experience_rate']);
  if (experienceRate != null) {
    staffRemarkHistoryRows.experienceRate = experienceRate;
  }
  final String? feedback = jsonConvert.convert<String>(json['feedback']);
  if (feedback != null) {
    staffRemarkHistoryRows.feedback = feedback;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    staffRemarkHistoryRows.createdAt = createdAt;
  }
  return staffRemarkHistoryRows;
}

Map<String, dynamic> $StaffRemarkHistoryRowsToJson(StaffRemarkHistoryRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['company'] = entity.company;
  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 StaffRemarkHistoryRowsExtension on StaffRemarkHistoryRows {
  StaffRemarkHistoryRows copyWith({
    String? company,
    double? attitudeRate,
    double? groomingRate,
    double? performanceRate,
    double? experienceRate,
    String? feedback,
    String? createdAt,
  }) {
    return StaffRemarkHistoryRows()
      ..company = company ?? this.company
      ..attitudeRate = attitudeRate ?? this.attitudeRate
      ..groomingRate = groomingRate ?? this.groomingRate
      ..performanceRate = performanceRate ?? this.performanceRate
      ..experienceRate = experienceRate ?? this.experienceRate
      ..feedback = feedback ?? this.feedback
      ..createdAt = createdAt ?? this.createdAt;
  }
}