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

ContractPositionOptionEntity $ContractPositionOptionEntityFromJson(Map<String, dynamic> json) {
  final ContractPositionOptionEntity contractPositionOptionEntity = ContractPositionOptionEntity();
  final String? contractId = jsonConvert.convert<String>(json['contract_id']);
  if (contractId != null) {
    contractPositionOptionEntity.contractId = contractId;
  }
  final String? startDate = jsonConvert.convert<String>(json['start_date']);
  if (startDate != null) {
    contractPositionOptionEntity.startDate = startDate;
  }
  final String? endDate = jsonConvert.convert<String>(json['end_date']);
  if (endDate != null) {
    contractPositionOptionEntity.endDate = endDate;
  }
  final String? agencyName = jsonConvert.convert<String>(json['agency_name']);
  if (agencyName != null) {
    contractPositionOptionEntity.agencyName = agencyName;
  }
  return contractPositionOptionEntity;
}

Map<String, dynamic> $ContractPositionOptionEntityToJson(ContractPositionOptionEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['contract_id'] = entity.contractId;
  data['start_date'] = entity.startDate;
  data['end_date'] = entity.endDate;
  data['agency_name'] = entity.agencyName;
  return data;
}

extension ContractPositionOptionEntityExtension on ContractPositionOptionEntity {
  ContractPositionOptionEntity copyWith({
    String? contractId,
    String? startDate,
    String? endDate,
    String? agencyName,
  }) {
    return ContractPositionOptionEntity()
      ..contractId = contractId ?? this.contractId
      ..startDate = startDate ?? this.startDate
      ..endDate = endDate ?? this.endDate
      ..agencyName = agencyName ?? this.agencyName;
  }
}