001package org.hl7.fhir.convertors.conv43_50.datatypes43_50.general43_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext43_50;
004import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Code43_50;
005import org.hl7.fhir.convertors.conv43_50.datatypes43_50.primitive43_50.Decimal43_50;
006import org.hl7.fhir.exceptions.FHIRException;
007
008public class Money43_50 {
009  public static org.hl7.fhir.r5.model.Money convertMoney(org.hl7.fhir.r4b.model.Money src) throws FHIRException {
010    if (src == null) return null;
011    org.hl7.fhir.r5.model.Money tgt = new org.hl7.fhir.r5.model.Money();
012    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
013    if (src.hasValue()) tgt.setValueElement(Decimal43_50.convertDecimal(src.getValueElement()));
014    if (src.hasCurrency()) tgt.setCurrencyElement(Code43_50.convertCode(src.getCurrencyElement()));
015    return tgt;
016  }
017
018  public static org.hl7.fhir.r4b.model.Money convertMoney(org.hl7.fhir.r5.model.Money src) throws FHIRException {
019    if (src == null) return null;
020    org.hl7.fhir.r4b.model.Money tgt = new org.hl7.fhir.r4b.model.Money();
021    ConversionContext43_50.INSTANCE.getVersionConvertor_43_50().copyElement(src, tgt);
022    if (src.hasValue()) tgt.setValueElement(Decimal43_50.convertDecimal(src.getValueElement()));
023    if (src.hasCurrency()) tgt.setCurrencyElement(Code43_50.convertCode(src.getCurrencyElement()));
024    return tgt;
025  }
026}