001package org.hl7.fhir.convertors.conv30_40;
002
003import org.hl7.fhir.convertors.VersionConvertor_30_40;
004import org.hl7.fhir.exceptions.FHIRException;
005
006public class AppointmentResponse30_40 {
007
008    public static org.hl7.fhir.r4.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.dstu3.model.AppointmentResponse src) throws FHIRException {
009        if (src == null)
010            return null;
011        org.hl7.fhir.r4.model.AppointmentResponse tgt = new org.hl7.fhir.r4.model.AppointmentResponse();
012        VersionConvertor_30_40.copyDomainResource(src, tgt);
013        for (org.hl7.fhir.dstu3.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t));
014        if (src.hasAppointment())
015            tgt.setAppointment(VersionConvertor_30_40.convertReference(src.getAppointment()));
016        if (src.hasStart())
017            tgt.setStartElement(VersionConvertor_30_40.convertInstant(src.getStartElement()));
018        if (src.hasEnd())
019            tgt.setEndElement(VersionConvertor_30_40.convertInstant(src.getEndElement()));
020        for (org.hl7.fhir.dstu3.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_30_40.convertCodeableConcept(t));
021        if (src.hasActor())
022            tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor()));
023        if (src.hasParticipantStatus())
024            tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement()));
025        if (src.hasComment())
026            tgt.setCommentElement(VersionConvertor_30_40.convertString(src.getCommentElement()));
027        return tgt;
028    }
029
030    public static org.hl7.fhir.dstu3.model.AppointmentResponse convertAppointmentResponse(org.hl7.fhir.r4.model.AppointmentResponse src) throws FHIRException {
031        if (src == null)
032            return null;
033        org.hl7.fhir.dstu3.model.AppointmentResponse tgt = new org.hl7.fhir.dstu3.model.AppointmentResponse();
034        VersionConvertor_30_40.copyDomainResource(src, tgt);
035        for (org.hl7.fhir.r4.model.Identifier t : src.getIdentifier()) tgt.addIdentifier(VersionConvertor_30_40.convertIdentifier(t));
036        if (src.hasAppointment())
037            tgt.setAppointment(VersionConvertor_30_40.convertReference(src.getAppointment()));
038        if (src.hasStart())
039            tgt.setStartElement(VersionConvertor_30_40.convertInstant(src.getStartElement()));
040        if (src.hasEnd())
041            tgt.setEndElement(VersionConvertor_30_40.convertInstant(src.getEndElement()));
042        for (org.hl7.fhir.r4.model.CodeableConcept t : src.getParticipantType()) tgt.addParticipantType(VersionConvertor_30_40.convertCodeableConcept(t));
043        if (src.hasActor())
044            tgt.setActor(VersionConvertor_30_40.convertReference(src.getActor()));
045        if (src.hasParticipantStatus())
046            tgt.setParticipantStatusElement(convertParticipantStatus(src.getParticipantStatusElement()));
047        if (src.hasComment())
048            tgt.setCommentElement(VersionConvertor_30_40.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.r4.model.Enumeration<org.hl7.fhir.r4.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_30_40.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 NEEDSACTION:
068                tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NEEDSACTION);
069                break;
070            default:
071                tgt.setValue(org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus.NULL);
072                break;
073        }
074        return tgt;
075    }
076
077    static public org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus> convertParticipantStatus(org.hl7.fhir.dstu3.model.Enumeration<org.hl7.fhir.dstu3.model.AppointmentResponse.ParticipantStatus> src) throws FHIRException {
078        if (src == null || src.isEmpty())
079            return null;
080        org.hl7.fhir.r4.model.Enumeration<org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus> tgt = new org.hl7.fhir.r4.model.Enumeration<>(new org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatusEnumFactory());
081        VersionConvertor_30_40.copyElement(src, tgt);
082        switch(src.getValue()) {
083            case ACCEPTED:
084                tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.ACCEPTED);
085                break;
086            case DECLINED:
087                tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.DECLINED);
088                break;
089            case TENTATIVE:
090                tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.TENTATIVE);
091                break;
092            case NEEDSACTION:
093                tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NEEDSACTION);
094                break;
095            default:
096                tgt.setValue(org.hl7.fhir.r4.model.AppointmentResponse.ParticipantStatus.NULL);
097                break;
098        }
099        return tgt;
100    }
101}