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

LabourReportVNEntity $LabourReportVNEntityFromJson(Map<String, dynamic> json) {
  final LabourReportVNEntity labourReportVNEntity = LabourReportVNEntity();
  final String? startDate = jsonConvert.convert<String>(json['start_date']);
  if (startDate != null) {
    labourReportVNEntity.startDate = startDate;
  }
  final String? endDate = jsonConvert.convert<String>(json['end_date']);
  if (endDate != null) {
    labourReportVNEntity.endDate = endDate;
  }
  final List<LabourReportVNRows>? rows = (json['rows'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<LabourReportVNRows>(e) as LabourReportVNRows).toList();
  if (rows != null) {
    labourReportVNEntity.rows = rows;
  }
  final LabourReportVNTotal? total = jsonConvert.convert<LabourReportVNTotal>(json['total']);
  if (total != null) {
    labourReportVNEntity.total = total;
  }
  return labourReportVNEntity;
}

Map<String, dynamic> $LabourReportVNEntityToJson(LabourReportVNEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['start_date'] = entity.startDate;
  data['end_date'] = entity.endDate;
  data['rows'] = entity.rows.map((v) => v.toJson()).toList();
  data['total'] = entity.total?.toJson();
  return data;
}

extension LabourReportVNEntityExtension on LabourReportVNEntity {
  LabourReportVNEntity copyWith({
    String? startDate,
    String? endDate,
    List<LabourReportVNRows>? rows,
    LabourReportVNTotal? total,
  }) {
    return LabourReportVNEntity()
      ..startDate = startDate ?? this.startDate
      ..endDate = endDate ?? this.endDate
      ..rows = rows ?? this.rows
      ..total = total ?? this.total;
  }
}

LabourReportVNRows $LabourReportVNRowsFromJson(Map<String, dynamic> json) {
  final LabourReportVNRows labourReportVNRows = LabourReportVNRows();
  final String? outletId = jsonConvert.convert<String>(json['outlet_id']);
  if (outletId != null) {
    labourReportVNRows.outletId = outletId;
  }
  final String? outletName = jsonConvert.convert<String>(json['outlet_name']);
  if (outletName != null) {
    labourReportVNRows.outletName = outletName;
  }
  final String? num = jsonConvert.convert<String>(json['num']);
  if (num != null) {
    labourReportVNRows.num = num;
  }
  final String? hrs = jsonConvert.convert<String>(json['hrs']);
  if (hrs != null) {
    labourReportVNRows.hrs = hrs;
  }
  final String? rms = jsonConvert.convert<String>(json['rms']);
  if (rms != null) {
    labourReportVNRows.rms = rms;
  }
  final String? amt = jsonConvert.convert<String>(json['amt']);
  if (amt != null) {
    labourReportVNRows.amt = amt;
  }
  final String? inNum = jsonConvert.convert<String>(json['in_num']);
  if (inNum != null) {
    labourReportVNRows.inNum = inNum;
  }
  final String? inHrs = jsonConvert.convert<String>(json['in_hrs']);
  if (inHrs != null) {
    labourReportVNRows.inHrs = inHrs;
  }
  final String? inRms = jsonConvert.convert<String>(json['in_rms']);
  if (inRms != null) {
    labourReportVNRows.inRms = inRms;
  }
  final String? inAmt = jsonConvert.convert<String>(json['in_amt']);
  if (inAmt != null) {
    labourReportVNRows.inAmt = inAmt;
  }
  final String? totNum = jsonConvert.convert<String>(json['tot_num']);
  if (totNum != null) {
    labourReportVNRows.totNum = totNum;
  }
  final String? totHrs = jsonConvert.convert<String>(json['tot_hrs']);
  if (totHrs != null) {
    labourReportVNRows.totHrs = totHrs;
  }
  final String? totRms = jsonConvert.convert<String>(json['tot_rms']);
  if (totRms != null) {
    labourReportVNRows.totRms = totRms;
  }
  final String? totAmt = jsonConvert.convert<String>(json['tot_amt']);
  if (totAmt != null) {
    labourReportVNRows.totAmt = totAmt;
  }
  return labourReportVNRows;
}

Map<String, dynamic> $LabourReportVNRowsToJson(LabourReportVNRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['outlet_id'] = entity.outletId;
  data['outlet_name'] = entity.outletName;
  data['num'] = entity.num;
  data['hrs'] = entity.hrs;
  data['rms'] = entity.rms;
  data['amt'] = entity.amt;
  data['in_num'] = entity.inNum;
  data['in_hrs'] = entity.inHrs;
  data['in_rms'] = entity.inRms;
  data['in_amt'] = entity.inAmt;
  data['tot_num'] = entity.totNum;
  data['tot_hrs'] = entity.totHrs;
  data['tot_rms'] = entity.totRms;
  data['tot_amt'] = entity.totAmt;
  return data;
}

extension LabourReportVNRowsExtension on LabourReportVNRows {
  LabourReportVNRows copyWith({
    String? outletId,
    String? outletName,
    String? num,
    String? hrs,
    String? rms,
    String? amt,
    String? inNum,
    String? inHrs,
    String? inRms,
    String? inAmt,
    String? totNum,
    String? totHrs,
    String? totRms,
    String? totAmt,
  }) {
    return LabourReportVNRows()
      ..outletId = outletId ?? this.outletId
      ..outletName = outletName ?? this.outletName
      ..num = num ?? this.num
      ..hrs = hrs ?? this.hrs
      ..rms = rms ?? this.rms
      ..amt = amt ?? this.amt
      ..inNum = inNum ?? this.inNum
      ..inHrs = inHrs ?? this.inHrs
      ..inRms = inRms ?? this.inRms
      ..inAmt = inAmt ?? this.inAmt
      ..totNum = totNum ?? this.totNum
      ..totHrs = totHrs ?? this.totHrs
      ..totRms = totRms ?? this.totRms
      ..totAmt = totAmt ?? this.totAmt;
  }
}

LabourReportVNTotal $LabourReportVNTotalFromJson(Map<String, dynamic> json) {
  final LabourReportVNTotal labourReportVNTotal = LabourReportVNTotal();
  final String? num = jsonConvert.convert<String>(json['num']);
  if (num != null) {
    labourReportVNTotal.num = num;
  }
  final double? hrs = jsonConvert.convert<double>(json['hrs']);
  if (hrs != null) {
    labourReportVNTotal.hrs = hrs;
  }
  final String? rms = jsonConvert.convert<String>(json['rms']);
  if (rms != null) {
    labourReportVNTotal.rms = rms;
  }
  final String? amt = jsonConvert.convert<String>(json['amt']);
  if (amt != null) {
    labourReportVNTotal.amt = amt;
  }
  final String? inNum = jsonConvert.convert<String>(json['in_num']);
  if (inNum != null) {
    labourReportVNTotal.inNum = inNum;
  }
  final String? inHrs = jsonConvert.convert<String>(json['in_hrs']);
  if (inHrs != null) {
    labourReportVNTotal.inHrs = inHrs;
  }
  final String? inRms = jsonConvert.convert<String>(json['in_rms']);
  if (inRms != null) {
    labourReportVNTotal.inRms = inRms;
  }
  final String? inAmt = jsonConvert.convert<String>(json['in_amt']);
  if (inAmt != null) {
    labourReportVNTotal.inAmt = inAmt;
  }
  final String? totNum = jsonConvert.convert<String>(json['tot_num']);
  if (totNum != null) {
    labourReportVNTotal.totNum = totNum;
  }
  final String? totHrs = jsonConvert.convert<String>(json['tot_hrs']);
  if (totHrs != null) {
    labourReportVNTotal.totHrs = totHrs;
  }
  final String? totRms = jsonConvert.convert<String>(json['tot_rms']);
  if (totRms != null) {
    labourReportVNTotal.totRms = totRms;
  }
  final String? totAmt = jsonConvert.convert<String>(json['tot_amt']);
  if (totAmt != null) {
    labourReportVNTotal.totAmt = totAmt;
  }
  return labourReportVNTotal;
}

Map<String, dynamic> $LabourReportVNTotalToJson(LabourReportVNTotal entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['num'] = entity.num;
  data['hrs'] = entity.hrs;
  data['rms'] = entity.rms;
  data['amt'] = entity.amt;
  data['in_num'] = entity.inNum;
  data['in_hrs'] = entity.inHrs;
  data['in_rms'] = entity.inRms;
  data['in_amt'] = entity.inAmt;
  data['tot_num'] = entity.totNum;
  data['tot_hrs'] = entity.totHrs;
  data['tot_rms'] = entity.totRms;
  data['tot_amt'] = entity.totAmt;
  return data;
}

extension LabourReportVNTotalExtension on LabourReportVNTotal {
  LabourReportVNTotal copyWith({
    String? num,
    double? hrs,
    String? rms,
    String? amt,
    String? inNum,
    String? inHrs,
    String? inRms,
    String? inAmt,
    String? totNum,
    String? totHrs,
    String? totRms,
    String? totAmt,
  }) {
    return LabourReportVNTotal()
      ..num = num ?? this.num
      ..hrs = hrs ?? this.hrs
      ..rms = rms ?? this.rms
      ..amt = amt ?? this.amt
      ..inNum = inNum ?? this.inNum
      ..inHrs = inHrs ?? this.inHrs
      ..inRms = inRms ?? this.inRms
      ..inAmt = inAmt ?? this.inAmt
      ..totNum = totNum ?? this.totNum
      ..totHrs = totHrs ?? this.totHrs
      ..totRms = totRms ?? this.totRms
      ..totAmt = totAmt ?? this.totAmt;
  }
}