fromJson static method

InvoicingCodeDto? fromJson(
  1. dynamic value
)

Returns a new InvoicingCodeDto instance and imports its values from value if it's a Map, null otherwise.

Implementation

// ignore: prefer_constructors_over_static_methods
static InvoicingCodeDto? fromJson(dynamic value) {
  if (value is InvoicingCodeDto) {
    return value;
  }
  if (value is Map) {
    final json = value.cast<String, dynamic>();

    // Ensure that the map contains the required keys.
    // Note 1: the values aren't checked for validity beyond being non-null.
    // Note 2: this code is stripped in release mode!
    assert(() {
      requiredKeys.forEach((key) {
        assert(json.containsKey(key), 'Required key "InvoicingCodeDto[$key]" is missing from JSON.');
        assert(json[key] != null, 'Required key "InvoicingCodeDto[$key]" has a null value in JSON.');
      });
      return true;
    }());

    return InvoicingCodeDto(
      id: mapValueOfType<String>(json, r'id'),
      dateCode: mapValueOfType<int>(json, r'dateCode'),
      logicalId: mapValueOfType<String>(json, r'logicalId'),
      label: mapValueOfType<String>(json, r'label'),
      userId: mapValueOfType<String>(json, r'userId'),
      contactId: mapValueOfType<String>(json, r'contactId'),
      serviceId: mapValueOfType<String>(json, r'serviceId'),
      tarificationId: mapValueOfType<String>(json, r'tarificationId'),
      code: mapValueOfType<String>(json, r'code'),
      paymentType: InvoicingCodeDtoPaymentTypeEnum.fromJson(json[r'paymentType']),
      paid: mapValueOfType<double>(json, r'paid'),
      totalAmount: mapValueOfType<double>(json, r'totalAmount'),
      reimbursement: mapValueOfType<double>(json, r'reimbursement'),
      patientIntervention: mapValueOfType<double>(json, r'patientIntervention'),
      doctorSupplement: mapValueOfType<double>(json, r'doctorSupplement'),
      conventionAmount: mapValueOfType<double>(json, r'conventionAmount'),
      vat: mapValueOfType<double>(json, r'vat'),
      error: mapValueOfType<String>(json, r'error'),
      contract: mapValueOfType<String>(json, r'contract'),
      contractDate: mapValueOfType<int>(json, r'contractDate'),
      units: mapValueOfType<int>(json, r'units'),
      side: mapValueOfType<int>(json, r'side'),
      timeOfDay: mapValueOfType<int>(json, r'timeOfDay'),
      eidReadingHour: mapValueOfType<int>(json, r'eidReadingHour'),
      eidReadingValue: mapValueOfType<String>(json, r'eidReadingValue'),
      override3rdPayerCode: mapValueOfType<int>(json, r'override3rdPayerCode'),
      override3rdPayerReason: mapValueOfType<String>(json, r'override3rdPayerReason'),
      transplantationCode: mapValueOfType<int>(json, r'transplantationCode'),
      prescriberNorm: mapValueOfType<int>(json, r'prescriberNorm'),
      percentNorm: mapValueOfType<int>(json, r'percentNorm'),
      prescriberNihii: mapValueOfType<String>(json, r'prescriberNihii'),
      relatedCode: mapValueOfType<String>(json, r'relatedCode'),
      prescriptionDate: mapValueOfType<int>(json, r'prescriptionDate'),
      derogationMaxNumber: mapValueOfType<int>(json, r'derogationMaxNumber'),
      prescriberSsin: mapValueOfType<String>(json, r'prescriberSsin'),
      prescriberLastName: mapValueOfType<String>(json, r'prescriberLastName'),
      prescriberFirstName: mapValueOfType<String>(json, r'prescriberFirstName'),
      prescriberCdHcParty: mapValueOfType<String>(json, r'prescriberCdHcParty'),
      locationNihii: mapValueOfType<String>(json, r'locationNihii'),
      locationCdHcParty: mapValueOfType<String>(json, r'locationCdHcParty'),
      locationService: mapValueOfType<int>(json, r'locationService'),
      canceled: mapValueOfType<bool>(json, r'canceled'),
      accepted: mapValueOfType<bool>(json, r'accepted'),
      pending: mapValueOfType<bool>(json, r'pending'),
      resent: mapValueOfType<bool>(json, r'resent'),
      archived: mapValueOfType<bool>(json, r'archived'),
      lost: mapValueOfType<bool>(json, r'lost'),
      insuranceJustification: mapValueOfType<int>(json, r'insuranceJustification'),
      cancelPatientInterventionReason: mapValueOfType<int>(json, r'cancelPatientInterventionReason'),
      status: mapValueOfType<int>(json, r'status'),
      encryptedSelf: mapValueOfType<String>(json, r'encryptedSelf'),
    );
  }
  return null;
}