fromJson static method
Returns a new MedicalHouseContractDto instance and imports its values from
value
if it's a Map, null otherwise.
Implementation
// ignore: prefer_constructors_over_static_methods
static MedicalHouseContractDto? fromJson(dynamic value) {
if (value is MedicalHouseContractDto) {
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 "MedicalHouseContractDto[$key]" is missing from JSON.');
assert(json[key] != null, 'Required key "MedicalHouseContractDto[$key]" has a null value in JSON.');
});
return true;
}());
return MedicalHouseContractDto(
contractId: mapValueOfType<String>(json, r'contractId'),
validFrom: mapValueOfType<int>(json, r'validFrom'),
validTo: mapValueOfType<int>(json, r'validTo'),
mmNihii: mapValueOfType<String>(json, r'mmNihii'),
hcpId: mapValueOfType<String>(json, r'hcpId'),
changeType: MedicalHouseContractDtoChangeTypeEnum.fromJson(json[r'changeType']),
parentContractId: mapValueOfType<String>(json, r'parentContractId'),
changedBy: mapValueOfType<String>(json, r'changedBy'),
startOfContract: mapValueOfType<int>(json, r'startOfContract'),
startOfCoverage: mapValueOfType<int>(json, r'startOfCoverage'),
endOfContract: mapValueOfType<int>(json, r'endOfContract'),
endOfCoverage: mapValueOfType<int>(json, r'endOfCoverage'),
kine: mapValueOfType<bool>(json, r'kine')!,
gp: mapValueOfType<bool>(json, r'gp')!,
ptd: mapValueOfType<bool>(json, r'ptd')!,
nurse: mapValueOfType<bool>(json, r'nurse')!,
noKine: mapValueOfType<bool>(json, r'noKine')!,
noGp: mapValueOfType<bool>(json, r'noGp')!,
noNurse: mapValueOfType<bool>(json, r'noNurse')!,
unsubscriptionReasonId: mapValueOfType<int>(json, r'unsubscriptionReasonId'),
ptdStart: mapValueOfType<int>(json, r'ptdStart'),
ptdEnd: mapValueOfType<int>(json, r'ptdEnd'),
ptdLastInvoiced: mapValueOfType<int>(json, r'ptdLastInvoiced'),
startOfSuspension: mapValueOfType<int>(json, r'startOfSuspension'),
endOfSuspension: mapValueOfType<int>(json, r'endOfSuspension'),
suspensionReason: MedicalHouseContractDtoSuspensionReasonEnum.fromJson(json[r'suspensionReason']),
suspensionSource: mapValueOfType<String>(json, r'suspensionSource'),
forcedSuspension: mapValueOfType<bool>(json, r'forcedSuspension')!,
signatureType: MedicalHouseContractDtoSignatureTypeEnum.fromJson(json[r'signatureType']),
status: mapValueOfType<int>(json, r'status'),
options: mapCastOfType<String, String>(json, r'options')!,
receipts: mapCastOfType<String, String>(json, r'receipts')!,
encryptedSelf: mapValueOfType<String>(json, r'encryptedSelf'),
);
}
return null;
}