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