001package org.hl7.fhir.convertors.conv10_30;
002
003import org.hl7.fhir.convertors.VersionConvertor_10_30;
004import org.hl7.fhir.exceptions.FHIRException;
005
006public class AppointmentResponse10_30 {
007
008    public static org.hl7.fhir.dstu2.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException {
009        if (src == null || src.isEmpty())
010            return null;
011        org.hl7.fhir.dstu2.model.AppointmentResponse tgt = new org.hl7.fhir.dstu2.model.AppointmentResponse();
012        VersionConvertor_10_30.copyDomainResource(src, tgt);
013        for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t));
014        if (src.hasAppointment())
015            tgt.setAppointment(VersionConvertor_10_30.convertReference(src.getAppointment()));
016        if (src.hasStartElement())
017            tgt.setStartElement(VersionConvertor_10_30.convertInstant(src.getStartElement()));
018        if (src.hasEndElement())
019            tgt.setEndElement(VersionConvertor_10_30.convertInstant(src.getEndElement()));
020        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_10_30.convertCodeableConcept(t));
021        if (src.hasActor())
022            tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor()));
023        if (src.hasParticipantStatus())
024            tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement()));
025        if (src.hasCommentElement())
026            tgt.setCommentElement(VersionConvertor_10_30.convertString(src.getCommentElement()));
027        return tgt;
028    }
029
030    public static org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu2.model.AppointmentResponse src) throws FHIRException {
031        if (src == null || src.isEmpty())
032            return null;
033        org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse();
034        VersionConvertor_10_30.copyDomainResource(src, tgt);
035        for (org.hl7.fhir.dstu2.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_10_30.convertIdentifier(t));
036        if (src.hasAppointment())
037            tgt.setAppointment(VersionConvertor_10_30.convertReference(src.getAppointment()));
038        if (src.hasStartElement())
039            tgt.setStartElement(VersionConvertor_10_30.convertInstant(src.getStartElement()));
040        if (src.hasEndElement())
041            tgt.setEndElement(VersionConvertor_10_30.convertInstant(src.getEndElement()));
042        for (org.hl7.fhir.dstu2.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_10_30.convertCodeableConcept(t));
043        if (src.hasActor())
044            tgt.setActor(VersionConvertor_10_30.convertReference(src.getActor()));
045        if (src.hasParticipantStatus())
046            tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement()));
047        if (src.hasCommentElement())
048            tgt.setCommentElement(VersionConvertor_10_30.convertString(src.getCommentElement()));
049        return tgt;
050    }
051
052    static public org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus> convertParticipantStatus(org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus> src) throws FHIRException {
053        if (src == null || src.isEmpty())
054            return null;
055        org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus> tgt = new org.hl7.fhir.dstu3.model.Enumeration<>(new org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatusEnumFactory());
056        VersionConvertor_10_30.copyElement(src, tgt);
057        switch(src.getValue()) {
058            case ACCEPTED:
059                tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED);
060                break;
061            case DECLINED:
062                tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.DECLINED);
063                break;
064            case TENTATIVE:
065                tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.TENTATIVE);
066                break;
067            case INPROCESS:
068                tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED);
069                break;
070            case COMPLETED:
071                tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.ACCEPTED);
072                break;
073            case NEEDSACTION:
074                tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION);
075                break;
076            default:
077                tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL);
078                break;
079        }
080        return tgt;
081    }
082
083    static public org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus> convertParticipantStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus> src) throws FHIRException {
084        if (src == null || src.isEmpty())
085            return null;
086        org.hl7.fhir.dstu2.model.Enumeration<org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus> tgt = new org.hl7.fhir.dstu2.model.Enumeration<>(new org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatusEnumFactory());
087        VersionConvertor_10_30.copyElement(src, tgt);
088        switch(src.getValue()) {
089            case ACCEPTED:
090                tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.ACCEPTED);
091                break;
092            case DECLINED:
093                tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.DECLINED);
094                break;
095            case TENTATIVE:
096                tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.TENTATIVE);
097                break;
098            case NEEDSACTION:
099                tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NEEDSACTION);
100                break;
101            default:
102                tgt.setValue(org.hl7.fhir.dstu2.model.AppointmentResponse.ParticipantStatus.NULL);
103                break;
104        }
105        return tgt;
106    }
107}