001package org.hl7.fhir.convertors.conv30_40.resources30_40;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_40;
004import org.hl7.fhir.convertors.conv30_40.datatypes30_40.Reference30_40;
005import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.CodeableConcept30_40;
006import org.hl7.fhir.convertors.conv30_40.datatypes30_40.complextypes30_40.Identifier30_40;
007import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.Date30_40;
008import org.hl7.fhir.convertors.conv30_40.datatypes30_40.primitivetypes30_40.DateTime30_40;
009import org.hl7.fhir.exceptions.FHIRException;
010
011public class PaymentNotice30_40 {
012
013  public static org.hl7.fhir.r4.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.dstu3.model.PaymentNotice src) throws FHIRException {
014    if (src == null)
015      return null;
016    org.hl7.fhir.r4.model.PaymentNotice tgt = new org.hl7.fhir.r4.model.PaymentNotice();
017    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
018    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
019      tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
020    if (src.hasStatus())
021      tgt.setStatusElement(convertPaymentNoticeStatus(src.getStatusElement()));
022    if (src.hasRequest())
023      tgt.setRequest(Reference30_40.convertReference(src.getRequest()));
024    if (src.hasResponse())
025      tgt.setResponse(Reference30_40.convertReference(src.getResponse()));
026    if (src.hasStatusDate())
027      tgt.setPaymentDateElement(Date30_40.convertDate(src.getStatusDateElement()));
028    if (src.hasCreated())
029      tgt.setCreatedElement(DateTime30_40.convertDateTime(src.getCreatedElement()));
030    if (src.hasTarget())
031      tgt.setRecipient(Reference30_40.convertReference(src.getTarget()));
032    if (src.hasProvider())
033      tgt.setProvider(Reference30_40.convertReference(src.getProvider()));
034    if (src.hasPaymentStatus())
035      tgt.setPaymentStatus(CodeableConcept30_40.convertCodeableConcept(src.getPaymentStatus()));
036    return tgt;
037  }
038
039  public static org.hl7.fhir.dstu3.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r4.model.PaymentNotice src) throws FHIRException {
040    if (src == null)
041      return null;
042    org.hl7.fhir.dstu3.model.PaymentNotice tgt = new org.hl7.fhir.dstu3.model.PaymentNotice();
043    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyDomainResource(src, tgt);
044    for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier())
045      tgt.addIdentifier(Identifier30_40.convertIdentifier(t));
046    if (src.hasStatus())
047      tgt.setStatusElement(convertPaymentNoticeStatus(src.getStatusElement()));
048    if (src.hasRequest())
049      tgt.setRequest(Reference30_40.convertReference(src.getRequest()));
050    if (src.hasResponse())
051      tgt.setResponse(Reference30_40.convertReference(src.getResponse()));
052    if (src.hasPaymentDate())
053      tgt.setStatusDateElement(Date30_40.convertDate(src.getPaymentDateElement()));
054    if (src.hasCreated())
055      tgt.setCreatedElement(DateTime30_40.convertDateTime(src.getCreatedElement()));
056    if (src.hasRecipient())
057      tgt.setTarget(Reference30_40.convertReference(src.getRecipient()));
058    if (src.hasProvider())
059      tgt.setProvider(Reference30_40.convertReference(src.getProvider()));
060    if (src.hasPaymentStatus())
061      tgt.setPaymentStatus(CodeableConcept30_40.convertCodeableConcept(src.getPaymentStatus()));
062    return tgt;
063  }
064
065  static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus> convertPaymentNoticeStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus> src) throws FHIRException {
066    if (src == null || src.isEmpty())
067      return null;
068    org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatusEnumFactory());
069    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
070    switch (src.getValue()) {
071      case ACTIVE:
072        tgt.setValue(org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.ACTIVE);
073        break;
074      case CANCELLED:
075        tgt.setValue(org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.CANCELLED);
076        break;
077      case DRAFT:
078        tgt.setValue(org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.DRAFT);
079        break;
080      case ENTEREDINERROR:
081        tgt.setValue(org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR);
082        break;
083      default:
084        tgt.setValue(org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus.NULL);
085        break;
086    }
087    return tgt;
088  }
089
090  static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus> convertPaymentNoticeStatus(org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.PaymentNotice.PaymentNoticeStatus> src) throws FHIRException {
091    if (src == null || src.isEmpty())
092      return null;
093    org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatusEnumFactory());
094    ConversionContext30_40.INSTANCE.getVersionConvertor_30_40().copyElement(src, tgt);
095    switch (src.getValue()) {
096      case ACTIVE:
097        tgt.setValue(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ACTIVE);
098        break;
099      case CANCELLED:
100        tgt.setValue(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.CANCELLED);
101        break;
102      case DRAFT:
103        tgt.setValue(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.DRAFT);
104        break;
105      case ENTEREDINERROR:
106        tgt.setValue(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.ENTEREDINERROR);
107        break;
108      default:
109        tgt.setValue(org.hl7.fhir.dstu3.model.PaymentNotice.PaymentNoticeStatus.NULL);
110        break;
111    }
112    return tgt;
113  }
114}