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


UKTemplateDetailEntity $UKTemplateDetailEntityFromJson(Map<String, dynamic> json) {
  final UKTemplateDetailEntity uKTemplateDetailEntity = UKTemplateDetailEntity();
  final UKTemplateDetailRow? row = jsonConvert.convert<UKTemplateDetailRow>(json['row']);
  if (row != null) {
    uKTemplateDetailEntity.row = row;
  }
  final List<IndexOptionEntity>? certificateList = (json['certificate_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (certificateList != null) {
    uKTemplateDetailEntity.certificateList = certificateList;
  }
  final List<IndexOptionEntity>? vehicleList = (json['vehicle_list'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<IndexOptionEntity>(e) as IndexOptionEntity).toList();
  if (vehicleList != null) {
    uKTemplateDetailEntity.vehicleList = vehicleList;
  }
  return uKTemplateDetailEntity;
}

Map<String, dynamic> $UKTemplateDetailEntityToJson(UKTemplateDetailEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['row'] = entity.row?.toJson();
  data['certificate_list'] = entity.certificateList?.map((v) => v.toJson()).toList();
  data['vehicle_list'] = entity.vehicleList?.map((v) => v.toJson()).toList();
  return data;
}

extension UKTemplateDetailEntityExtension on UKTemplateDetailEntity {
  UKTemplateDetailEntity copyWith({
    UKTemplateDetailRow? row,
    List<IndexOptionEntity>? certificateList,
    List<IndexOptionEntity>? vehicleList,
  }) {
    return UKTemplateDetailEntity()
      ..row = row ?? this.row
      ..certificateList = certificateList ?? this.certificateList
      ..vehicleList = vehicleList ?? this.vehicleList;
  }
}

UKTemplateDetailRow $UKTemplateDetailRowFromJson(Map<String, dynamic> json) {
  final UKTemplateDetailRow uKTemplateDetailRow = UKTemplateDetailRow();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    uKTemplateDetailRow.id = id;
  }
  final String? companyId = jsonConvert.convert<String>(json['company_id']);
  if (companyId != null) {
    uKTemplateDetailRow.companyId = companyId;
  }
  final String? jobTitle = jsonConvert.convert<String>(json['job_title']);
  if (jobTitle != null) {
    uKTemplateDetailRow.jobTitle = jobTitle;
  }
  final String? contactName = jsonConvert.convert<String>(json['contact_name']);
  if (contactName != null) {
    uKTemplateDetailRow.contactName = contactName;
  }
  final String? contactNo = jsonConvert.convert<String>(json['contact_no']);
  if (contactNo != null) {
    uKTemplateDetailRow.contactNo = contactNo;
  }
  final String? vehicle = jsonConvert.convert<String>(json['vehicle']);
  if (vehicle != null) {
    uKTemplateDetailRow.vehicle = vehicle;
  }
  final String? certificate = jsonConvert.convert<String>(json['certificate']);
  if (certificate != null) {
    uKTemplateDetailRow.certificate = certificate;
  }
  final String? age = jsonConvert.convert<String>(json['age']);
  if (age != null) {
    uKTemplateDetailRow.age = age;
  }
  final String? language = jsonConvert.convert<String>(json['language']);
  if (language != null) {
    uKTemplateDetailRow.language = language;
  }
  final int? gender = jsonConvert.convert<int>(json['gender']);
  if (gender != null) {
    uKTemplateDetailRow.gender = gender;
  }
  final String? description = jsonConvert.convert<String>(json['description']);
  if (description != null) {
    uKTemplateDetailRow.description = description;
  }
  final String? note = jsonConvert.convert<String>(json['note']);
  if (note != null) {
    uKTemplateDetailRow.note = note;
  }
  final String? operatorId = jsonConvert.convert<String>(json['operator_id']);
  if (operatorId != null) {
    uKTemplateDetailRow.operatorId = operatorId;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    uKTemplateDetailRow.createdAt = createdAt;
  }
  final String? updatedAt = jsonConvert.convert<String>(json['updated_at']);
  if (updatedAt != null) {
    uKTemplateDetailRow.updatedAt = updatedAt;
  }
  final String? deletedAt = jsonConvert.convert<String>(json['deleted_at']);
  if (deletedAt != null) {
    uKTemplateDetailRow.deletedAt = deletedAt;
  }
  return uKTemplateDetailRow;
}

Map<String, dynamic> $UKTemplateDetailRowToJson(UKTemplateDetailRow entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['company_id'] = entity.companyId;
  data['job_title'] = entity.jobTitle;
  data['contact_name'] = entity.contactName;
  data['contact_no'] = entity.contactNo;
  data['vehicle'] = entity.vehicle;
  data['certificate'] = entity.certificate;
  data['age'] = entity.age;
  data['language'] = entity.language;
  data['gender'] = entity.gender;
  data['description'] = entity.description;
  data['note'] = entity.note;
  data['operator_id'] = entity.operatorId;
  data['created_at'] = entity.createdAt;
  data['updated_at'] = entity.updatedAt;
  data['deleted_at'] = entity.deletedAt;
  return data;
}

extension UKTemplateDetailRowExtension on UKTemplateDetailRow {
  UKTemplateDetailRow copyWith({
    String? id,
    String? companyId,
    String? jobTitle,
    String? contactName,
    String? contactNo,
    String? vehicle,
    String? certificate,
    String? age,
    String? language,
    int? gender,
    String? description,
    String? note,
    String? operatorId,
    String? createdAt,
    String? updatedAt,
    String? deletedAt,
  }) {
    return UKTemplateDetailRow()
      ..id = id ?? this.id
      ..companyId = companyId ?? this.companyId
      ..jobTitle = jobTitle ?? this.jobTitle
      ..contactName = contactName ?? this.contactName
      ..contactNo = contactNo ?? this.contactNo
      ..vehicle = vehicle ?? this.vehicle
      ..certificate = certificate ?? this.certificate
      ..age = age ?? this.age
      ..language = language ?? this.language
      ..gender = gender ?? this.gender
      ..description = description ?? this.description
      ..note = note ?? this.note
      ..operatorId = operatorId ?? this.operatorId
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt
      ..deletedAt = deletedAt ?? this.deletedAt;
  }
}