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

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

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

extension JobTitleSGEntityExtension on JobTitleSGEntity {
  JobTitleSGEntity copyWith({
    int? total,
    List<JobTitleSGRows>? rows,
  }) {
    return JobTitleSGEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

JobTitleSGRows $JobTitleSGRowsFromJson(Map<String, dynamic> json) {
  final JobTitleSGRows jobTitleSGRows = JobTitleSGRows();
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    jobTitleSGRows.id = id;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    jobTitleSGRows.jobTitle = jobTitle;
  }
  final String? templateName = jsonConvert.convert<String>(json['template_name']);
  if (templateName != null) {
    jobTitleSGRows.templateName = templateName;
  }
  final int? sort = jsonConvert.convert<int>(json['sort']);
  if (sort != null) {
    jobTitleSGRows.sort = sort;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    jobTitleSGRows.createdAt = createdAt;
  }
  final String? updatedAt = jsonConvert.convert<String>(json['updated_at']);
  if (updatedAt != null) {
    jobTitleSGRows.updatedAt = updatedAt;
  }
  final List<String>? actionList = (json['action_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<String>(e) as String).toList();
  if (actionList != null) {
    jobTitleSGRows.actionList = actionList;
  }
  return jobTitleSGRows;
}

Map<String, dynamic> $JobTitleSGRowsToJson(JobTitleSGRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['job_title'] = entity.jobTitle;
  data['template_name'] = entity.templateName;
  data['sort'] = entity.sort;
  data['created_at'] = entity.createdAt;
  data['updated_at'] = entity.updatedAt;
  data['action_list'] = entity.actionList;
  return data;
}

extension JobTitleSGRowsExtension on JobTitleSGRows {
  JobTitleSGRows copyWith({
    int? id,
    String? jobTitle,
    String? templateName,
    int? sort,
    String? createdAt,
    String? updatedAt,
    List<String>? actionList,
  }) {
    return JobTitleSGRows()
      ..id = id ?? this.id
      ..jobTitle = jobTitle ?? this.jobTitle
      ..templateName = templateName ?? this.templateName
      ..sort = sort ?? this.sort
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..actionList = actionList ?? this.actionList;
  }
}