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