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

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

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

extension ContractPositionRateTableEntityExtension on ContractPositionRateTableEntity {
  ContractPositionRateTableEntity copyWith({
    int? total,
    List<ContractPositionRateTableRows>? rows,
  }) {
    return ContractPositionRateTableEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows;
  }
}

ContractPositionRateTableRows $ContractPositionRateTableRowsFromJson(Map<String, dynamic> json) {
  final ContractPositionRateTableRows contractPositionRateTableRows = ContractPositionRateTableRows();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    contractPositionRateTableRows.id = id;
  }
  final String? agencyName = jsonConvert.convert<String>(json['agency_name']);
  if (agencyName != null) {
    contractPositionRateTableRows.agencyName = agencyName;
  }
  final String? position = jsonConvert.convert<String>(json['position']);
  if (position != null) {
    contractPositionRateTableRows.position = position;
  }
  final String? specialShow = jsonConvert.convert<String>(json['special_show']);
  if (specialShow != null) {
    contractPositionRateTableRows.specialShow = specialShow;
  }
  final String? amount = jsonConvert.convert<String>(json['amount']);
  if (amount != null) {
    contractPositionRateTableRows.amount = amount;
  }
  final String? createdAt = jsonConvert.convert<String>(json['created_at']);
  if (createdAt != null) {
    contractPositionRateTableRows.createdAt = createdAt;
  }
  final String? updatedAt = jsonConvert.convert<String>(json['updated_at']);
  if (updatedAt != null) {
    contractPositionRateTableRows.updatedAt = updatedAt;
  }
  return contractPositionRateTableRows;
}

Map<String, dynamic> $ContractPositionRateTableRowsToJson(ContractPositionRateTableRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['agency_name'] = entity.agencyName;
  data['position'] = entity.position;
  data['special_show'] = entity.specialShow;
  data['amount'] = entity.amount;
  data['created_at'] = entity.createdAt;
  data['updated_at'] = entity.updatedAt;
  return data;
}

extension ContractPositionRateTableRowsExtension on ContractPositionRateTableRows {
  ContractPositionRateTableRows copyWith({
    String? id,
    String? agencyName,
    String? position,
    String? specialShow,
    String? amount,
    String? createdAt,
    String? updatedAt,
  }) {
    return ContractPositionRateTableRows()
      ..id = id ?? this.id
      ..agencyName = agencyName ?? this.agencyName
      ..position = position ?? this.position
      ..specialShow = specialShow ?? this.specialShow
      ..amount = amount ?? this.amount
      ..createdAt = createdAt ?? this.createdAt
      ..updatedAt = updatedAt ?? this.updatedAt;
  }
}