001package org.hl7.fhir.convertors.conv30_50.resources30_50;
002
003import org.hl7.fhir.convertors.context.ConversionContext30_50;
004import org.hl7.fhir.convertors.conv30_50.datatypes30_50.Reference30_50;
005import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.CodeableConcept30_50;
006import org.hl7.fhir.convertors.conv30_50.datatypes30_50.complextypes30_50.Identifier30_50;
007import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.Date30_50;
008import org.hl7.fhir.convertors.conv30_50.datatypes30_50.primitivetypes30_50.DateTime30_50;
009import org.hl7.fhir.exceptions.FHIRException;
010
011public class PaymentNotice30_50 {
012
013  public static org.hl7.fhir.dstu3.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.r5.model.PaymentNotice src) throws FHIRException {
014    if (src == null)
015      return null;
016    org.hl7.fhir.dstu3.model.PaymentNotice tgt = new org.hl7.fhir.dstu3.model.PaymentNotice();
017    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
018    for (org.hl7.fhir.r5.model.Identifier t : src.getIdentifier())
019      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
020    if (src.hasStatus())
021      tgt.setStatusElement(convertPaymentNoticeStatus(src.getStatusElement()));
022    if (src.hasRequest())
023      tgt.setRequest(Reference30_50.convertReference(src.getRequest()));
024    if (src.hasResponse())
025      tgt.setResponse(Reference30_50.convertReference(src.getResponse()));
026    if (src.hasPaymentDate())
027      tgt.setStatusDateElement(Date30_50.convertDate(src.getPaymentDateElement()));
028    if (src.hasCreated())
029      tgt.setCreatedElement(DateTime30_50.convertDateTime(src.getCreatedElement()));
030    if (src.hasRecipient())
031      tgt.setTarget(Reference30_50.convertReference(src.getRecipient()));
032    if (src.hasProvider())
033      tgt.setProvider(Reference30_50.convertReference(src.getProvider()));
034    if (src.hasPaymentStatus())
035      tgt.setPaymentStatus(CodeableConcept30_50.convertCodeableConcept(src.getPaymentStatus()));
036    return tgt;
037  }
038
039  public static org.hl7.fhir.r5.model.PaymentNotice convertPaymentNotice(org.hl7.fhir.dstu3.model.PaymentNotice src) throws FHIRException {
040    if (src == null)
041      return null;
042    org.hl7.fhir.r5.model.PaymentNotice tgt = new org.hl7.fhir.r5.model.PaymentNotice();
043    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyDomainResource(src, tgt);
044    for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier())
045      tgt.addIdentifier(Identifier30_50.convertIdentifier(t));
046    if (src.hasStatus())
047      tgt.setStatusElement(convertPaymentNoticeStatus(src.getStatusElement()));
048    if (src.hasRequest())
049      tgt.setRequest(Reference30_50.convertReference(src.getRequest()));
050    if (src.hasResponse())
051      tgt.setResponse(Reference30_50.convertReference(src.getResponse()));
052    if (src.hasStatusDate())
053      tgt.setPaymentDateElement(Date30_50.convertDate(src.getStatusDateElement()));
054    if (src.hasCreated())
055      tgt.setCreatedElement(DateTime30_50.convertDateTime(src.getCreatedElement()));
056    if (src.hasTarget())
057      tgt.setRecipient(Reference30_50.convertReference(src.getTarget()));
058    if (src.hasProvider())
059      tgt.setProvider(Reference30_50.convertReference(src.getProvider()));
060    if (src.hasPaymentStatus())
061      tgt.setPaymentStatus(CodeableConcept30_50.convertCodeableConcept(src.getPaymentStatus()));
062    return tgt;
063  }
064
065  static public org.hl7.fhir.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes> 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.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes> tgt = new org.hl7.fhir.r5.model.Enumeration<>(new org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodesEnumFactory());
069    ConversionContext30_50.INSTANCE.getVersionConvertor_30_50().copyElement(src, tgt);
070    switch (src.getValue()) {
071      case ACTIVE:
072        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ACTIVE);
073        break;
074      case CANCELLED:
075        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.CANCELLED);
076        break;
077      case DRAFT:
078        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.DRAFT);
079        break;
080      case ENTEREDINERROR:
081        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.ENTEREDINERROR);
082        break;
083      default:
084        tgt.setValue(org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes.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.r5.model.Enumeration<org.hl7.fhir.r5.model.Enumerations.FinancialResourceStatusCodes> 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_50.INSTANCE.getVersionConvertor_30_50().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}