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

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

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

extension StaffJobHistorySGEntityExtension on StaffJobHistorySGEntity {
  StaffJobHistorySGEntity copyWith({
    int? total,
    List<StaffJobHistorySGRows>? rows,
  }) {
    return StaffJobHistorySGEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

StaffJobHistorySGRows $StaffJobHistorySGRowsFromJson(Map<String, dynamic> json) {
  final StaffJobHistorySGRows staffJobHistorySGRows = StaffJobHistorySGRows();
  final String? appliedId = jsonConvert.convert<String>(json['applied_id']);
  if (appliedId != null) {
    staffJobHistorySGRows.appliedId = appliedId;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    staffJobHistorySGRows.jobTitle = jobTitle;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    staffJobHistorySGRows.outletName = outletName;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    staffJobHistorySGRows.jobDate = jobDate;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    staffJobHistorySGRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    staffJobHistorySGRows.endTime = endTime;
  }
  final String? sourceShow = jsonConvert.convert<String>(json['source_show']);
  if (sourceShow != null) {
    staffJobHistorySGRows.sourceShow = sourceShow;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    staffJobHistorySGRows.statusShow = statusShow;
  }
  final int? showStar = jsonConvert.convert<int>(json['show_star']);
  if (showStar != null) {
    staffJobHistorySGRows.showStar = showStar;
  }
  return staffJobHistorySGRows;
}

Map<String, dynamic> $StaffJobHistorySGRowsToJson(StaffJobHistorySGRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['applied_id'] = entity.appliedId;
  data['job_title'] = entity.jobTitle;
  data['outlet_name'] = entity.outletName;
  data['job_date'] = entity.jobDate;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['source_show'] = entity.sourceShow;
  data['status_show'] = entity.statusShow;
  data['show_star'] = entity.showStar;
  return data;
}

extension StaffJobHistorySGRowsExtension on StaffJobHistorySGRows {
  StaffJobHistorySGRows copyWith({
    String? appliedId,
    String? jobTitle,
    String? outletName,
    String? jobDate,
    String? startTime,
    String? endTime,
    String? sourceShow,
    String? statusShow,
    int? showStar,
  }) {
    return StaffJobHistorySGRows()
      ..appliedId = appliedId ?? this.appliedId
      ..jobTitle = jobTitle ?? this.jobTitle
      ..outletName = outletName ?? this.outletName
      ..jobDate = jobDate ?? this.jobDate
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..sourceShow = sourceShow ?? this.sourceShow
      ..statusShow = statusShow ?? this.statusShow
      ..showStar = showStar ?? this.showStar;
  }
}