001package org.hl7.fhir.r4.model;
002
003
004
005/*
006  Copyright (c) 2011+, HL7, Inc.
007  All rights reserved.
008  
009  Redistribution and use in source and binary forms, with or without modification, 
010  are permitted provided that the following conditions are met:
011  
012   * Redistributions of source code must retain the above copyright notice, this 
013     list of conditions and the following disclaimer.
014   * Redistributions in binary form must reproduce the above copyright notice, 
015     this list of conditions and the following disclaimer in the documentation 
016     and/or other materials provided with the distribution.
017   * Neither the name of HL7 nor the names of its contributors may be used to 
018     endorse or promote products derived from this software without specific 
019     prior written permission.
020  
021  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
022  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
023  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
024  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
025  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
026  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
027  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
028  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
029  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
030  POSSIBILITY OF SUCH DAMAGE.
031  
032*/
033
034
035// Generated on Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
036
037import java.util.*;
038
039import org.hl7.fhir.utilities.Utilities;
040import ca.uhn.fhir.model.api.annotation.ResourceDef;
041import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
042import ca.uhn.fhir.model.api.annotation.Child;
043import ca.uhn.fhir.model.api.annotation.ChildOrder;
044import ca.uhn.fhir.model.api.annotation.Description;
045import ca.uhn.fhir.model.api.annotation.Block;
046import org.hl7.fhir.instance.model.api.*;
047import org.hl7.fhir.exceptions.FHIRException;
048/**
049 * This resource provides the insurance enrollment details to the insurer regarding a specified coverage.
050 */
051@ResourceDef(name="EnrollmentRequest", profile="http://hl7.org/fhir/StructureDefinition/EnrollmentRequest")
052public class EnrollmentRequest extends DomainResource {
053
054    public enum EnrollmentRequestStatus {
055        /**
056         * The instance is currently in-force.
057         */
058        ACTIVE, 
059        /**
060         * The instance is withdrawn, rescinded or reversed.
061         */
062        CANCELLED, 
063        /**
064         * A new instance the contents of which is not complete.
065         */
066        DRAFT, 
067        /**
068         * The instance was entered in error.
069         */
070        ENTEREDINERROR, 
071        /**
072         * added to help the parsers with the generic types
073         */
074        NULL;
075        public static EnrollmentRequestStatus fromCode(String codeString) throws FHIRException {
076            if (codeString == null || "".equals(codeString))
077                return null;
078        if ("active".equals(codeString))
079          return ACTIVE;
080        if ("cancelled".equals(codeString))
081          return CANCELLED;
082        if ("draft".equals(codeString))
083          return DRAFT;
084        if ("entered-in-error".equals(codeString))
085          return ENTEREDINERROR;
086        if (Configuration.isAcceptInvalidEnums())
087          return null;
088        else
089          throw new FHIRException("Unknown EnrollmentRequestStatus code '"+codeString+"'");
090        }
091        public String toCode() {
092          switch (this) {
093            case ACTIVE: return "active";
094            case CANCELLED: return "cancelled";
095            case DRAFT: return "draft";
096            case ENTEREDINERROR: return "entered-in-error";
097            default: return "?";
098          }
099        }
100        public String getSystem() {
101          switch (this) {
102            case ACTIVE: return "http://hl7.org/fhir/fm-status";
103            case CANCELLED: return "http://hl7.org/fhir/fm-status";
104            case DRAFT: return "http://hl7.org/fhir/fm-status";
105            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
106            default: return "?";
107          }
108        }
109        public String getDefinition() {
110          switch (this) {
111            case ACTIVE: return "The instance is currently in-force.";
112            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
113            case DRAFT: return "A new instance the contents of which is not complete.";
114            case ENTEREDINERROR: return "The instance was entered in error.";
115            default: return "?";
116          }
117        }
118        public String getDisplay() {
119          switch (this) {
120            case ACTIVE: return "Active";
121            case CANCELLED: return "Cancelled";
122            case DRAFT: return "Draft";
123            case ENTEREDINERROR: return "Entered in Error";
124            default: return "?";
125          }
126        }
127    }
128
129  public static class EnrollmentRequestStatusEnumFactory implements EnumFactory<EnrollmentRequestStatus> {
130    public EnrollmentRequestStatus fromCode(String codeString) throws IllegalArgumentException {
131      if (codeString == null || "".equals(codeString))
132            if (codeString == null || "".equals(codeString))
133                return null;
134        if ("active".equals(codeString))
135          return EnrollmentRequestStatus.ACTIVE;
136        if ("cancelled".equals(codeString))
137          return EnrollmentRequestStatus.CANCELLED;
138        if ("draft".equals(codeString))
139          return EnrollmentRequestStatus.DRAFT;
140        if ("entered-in-error".equals(codeString))
141          return EnrollmentRequestStatus.ENTEREDINERROR;
142        throw new IllegalArgumentException("Unknown EnrollmentRequestStatus code '"+codeString+"'");
143        }
144        public Enumeration<EnrollmentRequestStatus> fromType(Base code) throws FHIRException {
145          if (code == null)
146            return null;
147          if (code.isEmpty())
148            return new Enumeration<EnrollmentRequestStatus>(this);
149          String codeString = ((PrimitiveType) code).asStringValue();
150          if (codeString == null || "".equals(codeString))
151            return null;
152        if ("active".equals(codeString))
153          return new Enumeration<EnrollmentRequestStatus>(this, EnrollmentRequestStatus.ACTIVE);
154        if ("cancelled".equals(codeString))
155          return new Enumeration<EnrollmentRequestStatus>(this, EnrollmentRequestStatus.CANCELLED);
156        if ("draft".equals(codeString))
157          return new Enumeration<EnrollmentRequestStatus>(this, EnrollmentRequestStatus.DRAFT);
158        if ("entered-in-error".equals(codeString))
159          return new Enumeration<EnrollmentRequestStatus>(this, EnrollmentRequestStatus.ENTEREDINERROR);
160        throw new FHIRException("Unknown EnrollmentRequestStatus code '"+codeString+"'");
161        }
162    public String toCode(EnrollmentRequestStatus code) {
163      if (code == EnrollmentRequestStatus.ACTIVE)
164        return "active";
165      if (code == EnrollmentRequestStatus.CANCELLED)
166        return "cancelled";
167      if (code == EnrollmentRequestStatus.DRAFT)
168        return "draft";
169      if (code == EnrollmentRequestStatus.ENTEREDINERROR)
170        return "entered-in-error";
171      return "?";
172      }
173    public String toSystem(EnrollmentRequestStatus code) {
174      return code.getSystem();
175      }
176    }
177
178    /**
179     * The Response business identifier.
180     */
181    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
182    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
183    protected List<Identifier> identifier;
184
185    /**
186     * The status of the resource instance.
187     */
188    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
189    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
190    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
191    protected Enumeration<EnrollmentRequestStatus> status;
192
193    /**
194     * The date when this resource was created.
195     */
196    @Child(name = "created", type = {DateTimeType.class}, order=2, min=0, max=1, modifier=false, summary=false)
197    @Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
198    protected DateTimeType created;
199
200    /**
201     * The Insurer who is target  of the request.
202     */
203    @Child(name = "insurer", type = {Organization.class}, order=3, min=0, max=1, modifier=false, summary=false)
204    @Description(shortDefinition="Target", formalDefinition="The Insurer who is target  of the request." )
205    protected Reference insurer;
206
207    /**
208     * The actual object that is the target of the reference (The Insurer who is target  of the request.)
209     */
210    protected Organization insurerTarget;
211
212    /**
213     * The practitioner who is responsible for the services rendered to the patient.
214     */
215    @Child(name = "provider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=4, min=0, max=1, modifier=false, summary=false)
216    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
217    protected Reference provider;
218
219    /**
220     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
221     */
222    protected Resource providerTarget;
223
224    /**
225     * Patient Resource.
226     */
227    @Child(name = "candidate", type = {Patient.class}, order=5, min=0, max=1, modifier=false, summary=false)
228    @Description(shortDefinition="The subject to be enrolled", formalDefinition="Patient Resource." )
229    protected Reference candidate;
230
231    /**
232     * The actual object that is the target of the reference (Patient Resource.)
233     */
234    protected Patient candidateTarget;
235
236    /**
237     * Reference to the program or plan identification, underwriter or payor.
238     */
239    @Child(name = "coverage", type = {Coverage.class}, order=6, min=0, max=1, modifier=false, summary=false)
240    @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
241    protected Reference coverage;
242
243    /**
244     * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
245     */
246    protected Coverage coverageTarget;
247
248    private static final long serialVersionUID = 631501951L;
249
250  /**
251   * Constructor
252   */
253    public EnrollmentRequest() {
254      super();
255    }
256
257    /**
258     * @return {@link #identifier} (The Response business identifier.)
259     */
260    public List<Identifier> getIdentifier() { 
261      if (this.identifier == null)
262        this.identifier = new ArrayList<Identifier>();
263      return this.identifier;
264    }
265
266    /**
267     * @return Returns a reference to <code>this</code> for easy method chaining
268     */
269    public EnrollmentRequest setIdentifier(List<Identifier> theIdentifier) { 
270      this.identifier = theIdentifier;
271      return this;
272    }
273
274    public boolean hasIdentifier() { 
275      if (this.identifier == null)
276        return false;
277      for (Identifier item : this.identifier)
278        if (!item.isEmpty())
279          return true;
280      return false;
281    }
282
283    public Identifier addIdentifier() { //3
284      Identifier t = new Identifier();
285      if (this.identifier == null)
286        this.identifier = new ArrayList<Identifier>();
287      this.identifier.add(t);
288      return t;
289    }
290
291    public EnrollmentRequest addIdentifier(Identifier t) { //3
292      if (t == null)
293        return this;
294      if (this.identifier == null)
295        this.identifier = new ArrayList<Identifier>();
296      this.identifier.add(t);
297      return this;
298    }
299
300    /**
301     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
302     */
303    public Identifier getIdentifierFirstRep() { 
304      if (getIdentifier().isEmpty()) {
305        addIdentifier();
306      }
307      return getIdentifier().get(0);
308    }
309
310    /**
311     * @return {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
312     */
313    public Enumeration<EnrollmentRequestStatus> getStatusElement() { 
314      if (this.status == null)
315        if (Configuration.errorOnAutoCreate())
316          throw new Error("Attempt to auto-create EnrollmentRequest.status");
317        else if (Configuration.doAutoCreate())
318          this.status = new Enumeration<EnrollmentRequestStatus>(new EnrollmentRequestStatusEnumFactory()); // bb
319      return this.status;
320    }
321
322    public boolean hasStatusElement() { 
323      return this.status != null && !this.status.isEmpty();
324    }
325
326    public boolean hasStatus() { 
327      return this.status != null && !this.status.isEmpty();
328    }
329
330    /**
331     * @param value {@link #status} (The status of the resource instance.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value
332     */
333    public EnrollmentRequest setStatusElement(Enumeration<EnrollmentRequestStatus> value) { 
334      this.status = value;
335      return this;
336    }
337
338    /**
339     * @return The status of the resource instance.
340     */
341    public EnrollmentRequestStatus getStatus() { 
342      return this.status == null ? null : this.status.getValue();
343    }
344
345    /**
346     * @param value The status of the resource instance.
347     */
348    public EnrollmentRequest setStatus(EnrollmentRequestStatus value) { 
349      if (value == null)
350        this.status = null;
351      else {
352        if (this.status == null)
353          this.status = new Enumeration<EnrollmentRequestStatus>(new EnrollmentRequestStatusEnumFactory());
354        this.status.setValue(value);
355      }
356      return this;
357    }
358
359    /**
360     * @return {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
361     */
362    public DateTimeType getCreatedElement() { 
363      if (this.created == null)
364        if (Configuration.errorOnAutoCreate())
365          throw new Error("Attempt to auto-create EnrollmentRequest.created");
366        else if (Configuration.doAutoCreate())
367          this.created = new DateTimeType(); // bb
368      return this.created;
369    }
370
371    public boolean hasCreatedElement() { 
372      return this.created != null && !this.created.isEmpty();
373    }
374
375    public boolean hasCreated() { 
376      return this.created != null && !this.created.isEmpty();
377    }
378
379    /**
380     * @param value {@link #created} (The date when this resource was created.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
381     */
382    public EnrollmentRequest setCreatedElement(DateTimeType value) { 
383      this.created = value;
384      return this;
385    }
386
387    /**
388     * @return The date when this resource was created.
389     */
390    public Date getCreated() { 
391      return this.created == null ? null : this.created.getValue();
392    }
393
394    /**
395     * @param value The date when this resource was created.
396     */
397    public EnrollmentRequest setCreated(Date value) { 
398      if (value == null)
399        this.created = null;
400      else {
401        if (this.created == null)
402          this.created = new DateTimeType();
403        this.created.setValue(value);
404      }
405      return this;
406    }
407
408    /**
409     * @return {@link #insurer} (The Insurer who is target  of the request.)
410     */
411    public Reference getInsurer() { 
412      if (this.insurer == null)
413        if (Configuration.errorOnAutoCreate())
414          throw new Error("Attempt to auto-create EnrollmentRequest.insurer");
415        else if (Configuration.doAutoCreate())
416          this.insurer = new Reference(); // cc
417      return this.insurer;
418    }
419
420    public boolean hasInsurer() { 
421      return this.insurer != null && !this.insurer.isEmpty();
422    }
423
424    /**
425     * @param value {@link #insurer} (The Insurer who is target  of the request.)
426     */
427    public EnrollmentRequest setInsurer(Reference value) { 
428      this.insurer = value;
429      return this;
430    }
431
432    /**
433     * @return {@link #insurer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who is target  of the request.)
434     */
435    public Organization getInsurerTarget() { 
436      if (this.insurerTarget == null)
437        if (Configuration.errorOnAutoCreate())
438          throw new Error("Attempt to auto-create EnrollmentRequest.insurer");
439        else if (Configuration.doAutoCreate())
440          this.insurerTarget = new Organization(); // aa
441      return this.insurerTarget;
442    }
443
444    /**
445     * @param value {@link #insurer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who is target  of the request.)
446     */
447    public EnrollmentRequest setInsurerTarget(Organization value) { 
448      this.insurerTarget = value;
449      return this;
450    }
451
452    /**
453     * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
454     */
455    public Reference getProvider() { 
456      if (this.provider == null)
457        if (Configuration.errorOnAutoCreate())
458          throw new Error("Attempt to auto-create EnrollmentRequest.provider");
459        else if (Configuration.doAutoCreate())
460          this.provider = new Reference(); // cc
461      return this.provider;
462    }
463
464    public boolean hasProvider() { 
465      return this.provider != null && !this.provider.isEmpty();
466    }
467
468    /**
469     * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
470     */
471    public EnrollmentRequest setProvider(Reference value) { 
472      this.provider = value;
473      return this;
474    }
475
476    /**
477     * @return {@link #provider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
478     */
479    public Resource getProviderTarget() { 
480      return this.providerTarget;
481    }
482
483    /**
484     * @param value {@link #provider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
485     */
486    public EnrollmentRequest setProviderTarget(Resource value) { 
487      this.providerTarget = value;
488      return this;
489    }
490
491    /**
492     * @return {@link #candidate} (Patient Resource.)
493     */
494    public Reference getCandidate() { 
495      if (this.candidate == null)
496        if (Configuration.errorOnAutoCreate())
497          throw new Error("Attempt to auto-create EnrollmentRequest.candidate");
498        else if (Configuration.doAutoCreate())
499          this.candidate = new Reference(); // cc
500      return this.candidate;
501    }
502
503    public boolean hasCandidate() { 
504      return this.candidate != null && !this.candidate.isEmpty();
505    }
506
507    /**
508     * @param value {@link #candidate} (Patient Resource.)
509     */
510    public EnrollmentRequest setCandidate(Reference value) { 
511      this.candidate = value;
512      return this;
513    }
514
515    /**
516     * @return {@link #candidate} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Patient Resource.)
517     */
518    public Patient getCandidateTarget() { 
519      if (this.candidateTarget == null)
520        if (Configuration.errorOnAutoCreate())
521          throw new Error("Attempt to auto-create EnrollmentRequest.candidate");
522        else if (Configuration.doAutoCreate())
523          this.candidateTarget = new Patient(); // aa
524      return this.candidateTarget;
525    }
526
527    /**
528     * @param value {@link #candidate} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Patient Resource.)
529     */
530    public EnrollmentRequest setCandidateTarget(Patient value) { 
531      this.candidateTarget = value;
532      return this;
533    }
534
535    /**
536     * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
537     */
538    public Reference getCoverage() { 
539      if (this.coverage == null)
540        if (Configuration.errorOnAutoCreate())
541          throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
542        else if (Configuration.doAutoCreate())
543          this.coverage = new Reference(); // cc
544      return this.coverage;
545    }
546
547    public boolean hasCoverage() { 
548      return this.coverage != null && !this.coverage.isEmpty();
549    }
550
551    /**
552     * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
553     */
554    public EnrollmentRequest setCoverage(Reference value) { 
555      this.coverage = value;
556      return this;
557    }
558
559    /**
560     * @return {@link #coverage} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
561     */
562    public Coverage getCoverageTarget() { 
563      if (this.coverageTarget == null)
564        if (Configuration.errorOnAutoCreate())
565          throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
566        else if (Configuration.doAutoCreate())
567          this.coverageTarget = new Coverage(); // aa
568      return this.coverageTarget;
569    }
570
571    /**
572     * @param value {@link #coverage} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
573     */
574    public EnrollmentRequest setCoverageTarget(Coverage value) { 
575      this.coverageTarget = value;
576      return this;
577    }
578
579      protected void listChildren(List<Property> children) {
580        super.listChildren(children);
581        children.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
582        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
583        children.add(new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created));
584        children.add(new Property("insurer", "Reference(Organization)", "The Insurer who is target  of the request.", 0, 1, insurer));
585        children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider));
586        children.add(new Property("candidate", "Reference(Patient)", "Patient Resource.", 0, 1, candidate));
587        children.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage));
588      }
589
590      @Override
591      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
592        switch (_hash) {
593        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
594        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
595        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when this resource was created.", 0, 1, created);
596        case 1957615864: /*insurer*/  return new Property("insurer", "Reference(Organization)", "The Insurer who is target  of the request.", 0, 1, insurer);
597        case -987494927: /*provider*/  return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, provider);
598        case 508663171: /*candidate*/  return new Property("candidate", "Reference(Patient)", "Patient Resource.", 0, 1, candidate);
599        case -351767064: /*coverage*/  return new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, 1, coverage);
600        default: return super.getNamedProperty(_hash, _name, _checkValid);
601        }
602
603      }
604
605      @Override
606      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
607        switch (hash) {
608        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
609        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EnrollmentRequestStatus>
610        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
611        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
612        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
613        case 508663171: /*candidate*/ return this.candidate == null ? new Base[0] : new Base[] {this.candidate}; // Reference
614        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
615        default: return super.getProperty(hash, name, checkValid);
616        }
617
618      }
619
620      @Override
621      public Base setProperty(int hash, String name, Base value) throws FHIRException {
622        switch (hash) {
623        case -1618432855: // identifier
624          this.getIdentifier().add(castToIdentifier(value)); // Identifier
625          return value;
626        case -892481550: // status
627          value = new EnrollmentRequestStatusEnumFactory().fromType(castToCode(value));
628          this.status = (Enumeration) value; // Enumeration<EnrollmentRequestStatus>
629          return value;
630        case 1028554472: // created
631          this.created = castToDateTime(value); // DateTimeType
632          return value;
633        case 1957615864: // insurer
634          this.insurer = castToReference(value); // Reference
635          return value;
636        case -987494927: // provider
637          this.provider = castToReference(value); // Reference
638          return value;
639        case 508663171: // candidate
640          this.candidate = castToReference(value); // Reference
641          return value;
642        case -351767064: // coverage
643          this.coverage = castToReference(value); // Reference
644          return value;
645        default: return super.setProperty(hash, name, value);
646        }
647
648      }
649
650      @Override
651      public Base setProperty(String name, Base value) throws FHIRException {
652        if (name.equals("identifier")) {
653          this.getIdentifier().add(castToIdentifier(value));
654        } else if (name.equals("status")) {
655          value = new EnrollmentRequestStatusEnumFactory().fromType(castToCode(value));
656          this.status = (Enumeration) value; // Enumeration<EnrollmentRequestStatus>
657        } else if (name.equals("created")) {
658          this.created = castToDateTime(value); // DateTimeType
659        } else if (name.equals("insurer")) {
660          this.insurer = castToReference(value); // Reference
661        } else if (name.equals("provider")) {
662          this.provider = castToReference(value); // Reference
663        } else if (name.equals("candidate")) {
664          this.candidate = castToReference(value); // Reference
665        } else if (name.equals("coverage")) {
666          this.coverage = castToReference(value); // Reference
667        } else
668          return super.setProperty(name, value);
669        return value;
670      }
671
672      @Override
673      public Base makeProperty(int hash, String name) throws FHIRException {
674        switch (hash) {
675        case -1618432855:  return addIdentifier(); 
676        case -892481550:  return getStatusElement();
677        case 1028554472:  return getCreatedElement();
678        case 1957615864:  return getInsurer(); 
679        case -987494927:  return getProvider(); 
680        case 508663171:  return getCandidate(); 
681        case -351767064:  return getCoverage(); 
682        default: return super.makeProperty(hash, name);
683        }
684
685      }
686
687      @Override
688      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
689        switch (hash) {
690        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
691        case -892481550: /*status*/ return new String[] {"code"};
692        case 1028554472: /*created*/ return new String[] {"dateTime"};
693        case 1957615864: /*insurer*/ return new String[] {"Reference"};
694        case -987494927: /*provider*/ return new String[] {"Reference"};
695        case 508663171: /*candidate*/ return new String[] {"Reference"};
696        case -351767064: /*coverage*/ return new String[] {"Reference"};
697        default: return super.getTypesForProperty(hash, name);
698        }
699
700      }
701
702      @Override
703      public Base addChild(String name) throws FHIRException {
704        if (name.equals("identifier")) {
705          return addIdentifier();
706        }
707        else if (name.equals("status")) {
708          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentRequest.status");
709        }
710        else if (name.equals("created")) {
711          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentRequest.created");
712        }
713        else if (name.equals("insurer")) {
714          this.insurer = new Reference();
715          return this.insurer;
716        }
717        else if (name.equals("provider")) {
718          this.provider = new Reference();
719          return this.provider;
720        }
721        else if (name.equals("candidate")) {
722          this.candidate = new Reference();
723          return this.candidate;
724        }
725        else if (name.equals("coverage")) {
726          this.coverage = new Reference();
727          return this.coverage;
728        }
729        else
730          return super.addChild(name);
731      }
732
733  public String fhirType() {
734    return "EnrollmentRequest";
735
736  }
737
738      public EnrollmentRequest copy() {
739        EnrollmentRequest dst = new EnrollmentRequest();
740        copyValues(dst);
741        return dst;
742      }
743
744      public void copyValues(EnrollmentRequest dst) {
745        super.copyValues(dst);
746        if (identifier != null) {
747          dst.identifier = new ArrayList<Identifier>();
748          for (Identifier i : identifier)
749            dst.identifier.add(i.copy());
750        };
751        dst.status = status == null ? null : status.copy();
752        dst.created = created == null ? null : created.copy();
753        dst.insurer = insurer == null ? null : insurer.copy();
754        dst.provider = provider == null ? null : provider.copy();
755        dst.candidate = candidate == null ? null : candidate.copy();
756        dst.coverage = coverage == null ? null : coverage.copy();
757      }
758
759      protected EnrollmentRequest typedCopy() {
760        return copy();
761      }
762
763      @Override
764      public boolean equalsDeep(Base other_) {
765        if (!super.equalsDeep(other_))
766          return false;
767        if (!(other_ instanceof EnrollmentRequest))
768          return false;
769        EnrollmentRequest o = (EnrollmentRequest) other_;
770        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(created, o.created, true)
771           && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true) && compareDeep(candidate, o.candidate, true)
772           && compareDeep(coverage, o.coverage, true);
773      }
774
775      @Override
776      public boolean equalsShallow(Base other_) {
777        if (!super.equalsShallow(other_))
778          return false;
779        if (!(other_ instanceof EnrollmentRequest))
780          return false;
781        EnrollmentRequest o = (EnrollmentRequest) other_;
782        return compareValues(status, o.status, true) && compareValues(created, o.created, true);
783      }
784
785      public boolean isEmpty() {
786        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, created
787          , insurer, provider, candidate, coverage);
788      }
789
790  @Override
791  public ResourceType getResourceType() {
792    return ResourceType.EnrollmentRequest;
793   }
794
795 /**
796   * Search parameter: <b>identifier</b>
797   * <p>
798   * Description: <b>The business identifier of the Enrollment</b><br>
799   * Type: <b>token</b><br>
800   * Path: <b>EnrollmentRequest.identifier</b><br>
801   * </p>
802   */
803  @SearchParamDefinition(name="identifier", path="EnrollmentRequest.identifier", description="The business identifier of the Enrollment", type="token" )
804  public static final String SP_IDENTIFIER = "identifier";
805 /**
806   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
807   * <p>
808   * Description: <b>The business identifier of the Enrollment</b><br>
809   * Type: <b>token</b><br>
810   * Path: <b>EnrollmentRequest.identifier</b><br>
811   * </p>
812   */
813  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
814
815 /**
816   * Search parameter: <b>subject</b>
817   * <p>
818   * Description: <b>The party to be enrolled</b><br>
819   * Type: <b>reference</b><br>
820   * Path: <b>EnrollmentRequest.candidate</b><br>
821   * </p>
822   */
823  @SearchParamDefinition(name="subject", path="EnrollmentRequest.candidate", description="The party to be enrolled", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
824  public static final String SP_SUBJECT = "subject";
825 /**
826   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
827   * <p>
828   * Description: <b>The party to be enrolled</b><br>
829   * Type: <b>reference</b><br>
830   * Path: <b>EnrollmentRequest.candidate</b><br>
831   * </p>
832   */
833  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
834
835/**
836   * Constant for fluent queries to be used to add include statements. Specifies
837   * the path value of "<b>EnrollmentRequest:subject</b>".
838   */
839  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("EnrollmentRequest:subject").toLocked();
840
841 /**
842   * Search parameter: <b>patient</b>
843   * <p>
844   * Description: <b>The party to be enrolled</b><br>
845   * Type: <b>reference</b><br>
846   * Path: <b>EnrollmentRequest.candidate</b><br>
847   * </p>
848   */
849  @SearchParamDefinition(name="patient", path="EnrollmentRequest.candidate", description="The party to be enrolled", type="reference", target={Patient.class } )
850  public static final String SP_PATIENT = "patient";
851 /**
852   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
853   * <p>
854   * Description: <b>The party to be enrolled</b><br>
855   * Type: <b>reference</b><br>
856   * Path: <b>EnrollmentRequest.candidate</b><br>
857   * </p>
858   */
859  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
860
861/**
862   * Constant for fluent queries to be used to add include statements. Specifies
863   * the path value of "<b>EnrollmentRequest:patient</b>".
864   */
865  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("EnrollmentRequest:patient").toLocked();
866
867 /**
868   * Search parameter: <b>status</b>
869   * <p>
870   * Description: <b>The status of the enrollment</b><br>
871   * Type: <b>token</b><br>
872   * Path: <b>EnrollmentRequest.status</b><br>
873   * </p>
874   */
875  @SearchParamDefinition(name="status", path="EnrollmentRequest.status", description="The status of the enrollment", type="token" )
876  public static final String SP_STATUS = "status";
877 /**
878   * <b>Fluent Client</b> search parameter constant for <b>status</b>
879   * <p>
880   * Description: <b>The status of the enrollment</b><br>
881   * Type: <b>token</b><br>
882   * Path: <b>EnrollmentRequest.status</b><br>
883   * </p>
884   */
885  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
886
887
888}