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

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

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

extension JobListSGEntityExtension on JobListSGEntity {
  JobListSGEntity copyWith({
    int? total,
    List<JobListSGRows>? rows,
  }) {
    return JobListSGEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

JobListSGRows $JobListSGRowsFromJson(Map<String, dynamic> json) {
  final JobListSGRows jobListSGRows = JobListSGRows();
  final String? source = jsonConvert.convert<String>(json['source']);
  if (source != null) {
    jobListSGRows.source = source;
  }
  final String? jobId = jsonConvert.convert<String>(json['job_id']);
  if (jobId != null) {
    jobListSGRows.jobId = jobId;
  }
  final String? jobDate = jsonConvert.convert<String>(json['job_date']);
  if (jobDate != null) {
    jobListSGRows.jobDate = jobDate;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    jobListSGRows.outletName = outletName;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    jobListSGRows.jobTitle = jobTitle;
  }
  final String? startTime = jsonConvert.convert<String>(json['start_time']);
  if (startTime != null) {
    jobListSGRows.startTime = startTime;
  }
  final String? endTime = jsonConvert.convert<String>(json['end_time']);
  if (endTime != null) {
    jobListSGRows.endTime = endTime;
  }
  final int? status = jsonConvert.convert<int>(json['status']);
  if (status != null) {
    jobListSGRows.status = status;
  }
  final String? statusShow = jsonConvert.convert<String>(json['status_show']);
  if (statusShow != null) {
    jobListSGRows.statusShow = statusShow;
  }
  final String? hiringNum = jsonConvert.convert<String>(json['hiring_num']);
  if (hiringNum != null) {
    jobListSGRows.hiringNum = hiringNum;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    jobListSGRows.createdAt = createdAt;
  }
  final List<String>? actionList = (json['action_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (actionList != null) {
    jobListSGRows.actionList = actionList;
  }
  return jobListSGRows;
}

Map<String, dynamic> $JobListSGRowsToJson(JobListSGRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['source'] = entity.source;
  data['job_id'] = entity.jobId;
  data['job_date'] = entity.jobDate;
  data['outlet_name'] = entity.outletName;
  data['job_title'] = entity.jobTitle;
  data['start_time'] = entity.startTime;
  data['end_time'] = entity.endTime;
  data['status'] = entity.status;
  data['status_show'] = entity.statusShow;
  data['hiring_num'] = entity.hiringNum;
  data['created_at'] = entity.createdAt;
  data['action_list'] = entity.actionList;
  return data;
}

extension JobListSGRowsExtension on JobListSGRows {
  JobListSGRows copyWith({
    String? source,
    String? jobId,
    String? jobDate,
    String? outletName,
    String? jobTitle,
    String? startTime,
    String? endTime,
    int? status,
    String? statusShow,
    String? hiringNum,
    String? createdAt,
    List<String>? actionList,
  }) {
    return JobListSGRows()
      ..source = source ?? this.source
      ..jobId = jobId ?? this.jobId
      ..jobDate = jobDate ?? this.jobDate
      ..outletName = outletName ?? this.outletName
      ..jobTitle = jobTitle ?? this.jobTitle
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..status = status ?? this.status
      ..statusShow = statusShow ?? this.statusShow
      ..hiringNum = hiringNum ?? this.hiringNum
      ..createdAt = createdAt ?? this.createdAt
      ..actionList = actionList ?? this.actionList;
  }
}