001package org.hl7.fhir.dstu3.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 Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
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/Profile/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}, 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 Practitioner providerTarget;
220
221    /**
222     * The organization which is responsible for the services rendered to the patient.
223     */
224    @Child(name = "organization", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=false)
225    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
226    protected Reference organization;
227
228    /**
229     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
230     */
231    protected Organization organizationTarget;
232
233    /**
234     * Patient Resource.
235     */
236    @Child(name = "subject", type = {Patient.class}, order=6, min=0, max=1, modifier=false, summary=false)
237    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
238    protected Reference subject;
239
240    /**
241     * The actual object that is the target of the reference (Patient Resource.)
242     */
243    protected Patient subjectTarget;
244
245    /**
246     * Reference to the program or plan identification, underwriter or payor.
247     */
248    @Child(name = "coverage", type = {Coverage.class}, order=7, min=0, max=1, modifier=false, summary=false)
249    @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
250    protected Reference coverage;
251
252    /**
253     * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
254     */
255    protected Coverage coverageTarget;
256
257    private static final long serialVersionUID = -214445454L;
258
259  /**
260   * Constructor
261   */
262    public EnrollmentRequest() {
263      super();
264    }
265
266    /**
267     * @return {@link #identifier} (The Response business identifier.)
268     */
269    public List<Identifier> getIdentifier() { 
270      if (this.identifier == null)
271        this.identifier = new ArrayList<Identifier>();
272      return this.identifier;
273    }
274
275    /**
276     * @return Returns a reference to <code>this</code> for easy method chaining
277     */
278    public EnrollmentRequest setIdentifier(List<Identifier> theIdentifier) { 
279      this.identifier = theIdentifier;
280      return this;
281    }
282
283    public boolean hasIdentifier() { 
284      if (this.identifier == null)
285        return false;
286      for (Identifier item : this.identifier)
287        if (!item.isEmpty())
288          return true;
289      return false;
290    }
291
292    public Identifier addIdentifier() { //3
293      Identifier t = new Identifier();
294      if (this.identifier == null)
295        this.identifier = new ArrayList<Identifier>();
296      this.identifier.add(t);
297      return t;
298    }
299
300    public EnrollmentRequest addIdentifier(Identifier t) { //3
301      if (t == null)
302        return this;
303      if (this.identifier == null)
304        this.identifier = new ArrayList<Identifier>();
305      this.identifier.add(t);
306      return this;
307    }
308
309    /**
310     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
311     */
312    public Identifier getIdentifierFirstRep() { 
313      if (getIdentifier().isEmpty()) {
314        addIdentifier();
315      }
316      return getIdentifier().get(0);
317    }
318
319    /**
320     * @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
321     */
322    public Enumeration<EnrollmentRequestStatus> getStatusElement() { 
323      if (this.status == null)
324        if (Configuration.errorOnAutoCreate())
325          throw new Error("Attempt to auto-create EnrollmentRequest.status");
326        else if (Configuration.doAutoCreate())
327          this.status = new Enumeration<EnrollmentRequestStatus>(new EnrollmentRequestStatusEnumFactory()); // bb
328      return this.status;
329    }
330
331    public boolean hasStatusElement() { 
332      return this.status != null && !this.status.isEmpty();
333    }
334
335    public boolean hasStatus() { 
336      return this.status != null && !this.status.isEmpty();
337    }
338
339    /**
340     * @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
341     */
342    public EnrollmentRequest setStatusElement(Enumeration<EnrollmentRequestStatus> value) { 
343      this.status = value;
344      return this;
345    }
346
347    /**
348     * @return The status of the resource instance.
349     */
350    public EnrollmentRequestStatus getStatus() { 
351      return this.status == null ? null : this.status.getValue();
352    }
353
354    /**
355     * @param value The status of the resource instance.
356     */
357    public EnrollmentRequest setStatus(EnrollmentRequestStatus value) { 
358      if (value == null)
359        this.status = null;
360      else {
361        if (this.status == null)
362          this.status = new Enumeration<EnrollmentRequestStatus>(new EnrollmentRequestStatusEnumFactory());
363        this.status.setValue(value);
364      }
365      return this;
366    }
367
368    /**
369     * @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
370     */
371    public DateTimeType getCreatedElement() { 
372      if (this.created == null)
373        if (Configuration.errorOnAutoCreate())
374          throw new Error("Attempt to auto-create EnrollmentRequest.created");
375        else if (Configuration.doAutoCreate())
376          this.created = new DateTimeType(); // bb
377      return this.created;
378    }
379
380    public boolean hasCreatedElement() { 
381      return this.created != null && !this.created.isEmpty();
382    }
383
384    public boolean hasCreated() { 
385      return this.created != null && !this.created.isEmpty();
386    }
387
388    /**
389     * @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
390     */
391    public EnrollmentRequest setCreatedElement(DateTimeType value) { 
392      this.created = value;
393      return this;
394    }
395
396    /**
397     * @return The date when this resource was created.
398     */
399    public Date getCreated() { 
400      return this.created == null ? null : this.created.getValue();
401    }
402
403    /**
404     * @param value The date when this resource was created.
405     */
406    public EnrollmentRequest setCreated(Date value) { 
407      if (value == null)
408        this.created = null;
409      else {
410        if (this.created == null)
411          this.created = new DateTimeType();
412        this.created.setValue(value);
413      }
414      return this;
415    }
416
417    /**
418     * @return {@link #insurer} (The Insurer who is target  of the request.)
419     */
420    public Reference getInsurer() { 
421      if (this.insurer == null)
422        if (Configuration.errorOnAutoCreate())
423          throw new Error("Attempt to auto-create EnrollmentRequest.insurer");
424        else if (Configuration.doAutoCreate())
425          this.insurer = new Reference(); // cc
426      return this.insurer;
427    }
428
429    public boolean hasInsurer() { 
430      return this.insurer != null && !this.insurer.isEmpty();
431    }
432
433    /**
434     * @param value {@link #insurer} (The Insurer who is target  of the request.)
435     */
436    public EnrollmentRequest setInsurer(Reference value) { 
437      this.insurer = value;
438      return this;
439    }
440
441    /**
442     * @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.)
443     */
444    public Organization getInsurerTarget() { 
445      if (this.insurerTarget == null)
446        if (Configuration.errorOnAutoCreate())
447          throw new Error("Attempt to auto-create EnrollmentRequest.insurer");
448        else if (Configuration.doAutoCreate())
449          this.insurerTarget = new Organization(); // aa
450      return this.insurerTarget;
451    }
452
453    /**
454     * @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.)
455     */
456    public EnrollmentRequest setInsurerTarget(Organization value) { 
457      this.insurerTarget = value;
458      return this;
459    }
460
461    /**
462     * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
463     */
464    public Reference getProvider() { 
465      if (this.provider == null)
466        if (Configuration.errorOnAutoCreate())
467          throw new Error("Attempt to auto-create EnrollmentRequest.provider");
468        else if (Configuration.doAutoCreate())
469          this.provider = new Reference(); // cc
470      return this.provider;
471    }
472
473    public boolean hasProvider() { 
474      return this.provider != null && !this.provider.isEmpty();
475    }
476
477    /**
478     * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
479     */
480    public EnrollmentRequest setProvider(Reference value) { 
481      this.provider = value;
482      return this;
483    }
484
485    /**
486     * @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.)
487     */
488    public Practitioner getProviderTarget() { 
489      if (this.providerTarget == null)
490        if (Configuration.errorOnAutoCreate())
491          throw new Error("Attempt to auto-create EnrollmentRequest.provider");
492        else if (Configuration.doAutoCreate())
493          this.providerTarget = new Practitioner(); // aa
494      return this.providerTarget;
495    }
496
497    /**
498     * @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.)
499     */
500    public EnrollmentRequest setProviderTarget(Practitioner value) { 
501      this.providerTarget = value;
502      return this;
503    }
504
505    /**
506     * @return {@link #organization} (The organization which is responsible for the services rendered to the patient.)
507     */
508    public Reference getOrganization() { 
509      if (this.organization == null)
510        if (Configuration.errorOnAutoCreate())
511          throw new Error("Attempt to auto-create EnrollmentRequest.organization");
512        else if (Configuration.doAutoCreate())
513          this.organization = new Reference(); // cc
514      return this.organization;
515    }
516
517    public boolean hasOrganization() { 
518      return this.organization != null && !this.organization.isEmpty();
519    }
520
521    /**
522     * @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.)
523     */
524    public EnrollmentRequest setOrganization(Reference value) { 
525      this.organization = value;
526      return this;
527    }
528
529    /**
530     * @return {@link #organization} 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 organization which is responsible for the services rendered to the patient.)
531     */
532    public Organization getOrganizationTarget() { 
533      if (this.organizationTarget == null)
534        if (Configuration.errorOnAutoCreate())
535          throw new Error("Attempt to auto-create EnrollmentRequest.organization");
536        else if (Configuration.doAutoCreate())
537          this.organizationTarget = new Organization(); // aa
538      return this.organizationTarget;
539    }
540
541    /**
542     * @param value {@link #organization} 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 organization which is responsible for the services rendered to the patient.)
543     */
544    public EnrollmentRequest setOrganizationTarget(Organization value) { 
545      this.organizationTarget = value;
546      return this;
547    }
548
549    /**
550     * @return {@link #subject} (Patient Resource.)
551     */
552    public Reference getSubject() { 
553      if (this.subject == null)
554        if (Configuration.errorOnAutoCreate())
555          throw new Error("Attempt to auto-create EnrollmentRequest.subject");
556        else if (Configuration.doAutoCreate())
557          this.subject = new Reference(); // cc
558      return this.subject;
559    }
560
561    public boolean hasSubject() { 
562      return this.subject != null && !this.subject.isEmpty();
563    }
564
565    /**
566     * @param value {@link #subject} (Patient Resource.)
567     */
568    public EnrollmentRequest setSubject(Reference value) { 
569      this.subject = value;
570      return this;
571    }
572
573    /**
574     * @return {@link #subject} 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.)
575     */
576    public Patient getSubjectTarget() { 
577      if (this.subjectTarget == null)
578        if (Configuration.errorOnAutoCreate())
579          throw new Error("Attempt to auto-create EnrollmentRequest.subject");
580        else if (Configuration.doAutoCreate())
581          this.subjectTarget = new Patient(); // aa
582      return this.subjectTarget;
583    }
584
585    /**
586     * @param value {@link #subject} 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.)
587     */
588    public EnrollmentRequest setSubjectTarget(Patient value) { 
589      this.subjectTarget = value;
590      return this;
591    }
592
593    /**
594     * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
595     */
596    public Reference getCoverage() { 
597      if (this.coverage == null)
598        if (Configuration.errorOnAutoCreate())
599          throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
600        else if (Configuration.doAutoCreate())
601          this.coverage = new Reference(); // cc
602      return this.coverage;
603    }
604
605    public boolean hasCoverage() { 
606      return this.coverage != null && !this.coverage.isEmpty();
607    }
608
609    /**
610     * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
611     */
612    public EnrollmentRequest setCoverage(Reference value) { 
613      this.coverage = value;
614      return this;
615    }
616
617    /**
618     * @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.)
619     */
620    public Coverage getCoverageTarget() { 
621      if (this.coverageTarget == null)
622        if (Configuration.errorOnAutoCreate())
623          throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
624        else if (Configuration.doAutoCreate())
625          this.coverageTarget = new Coverage(); // aa
626      return this.coverageTarget;
627    }
628
629    /**
630     * @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.)
631     */
632    public EnrollmentRequest setCoverageTarget(Coverage value) { 
633      this.coverageTarget = value;
634      return this;
635    }
636
637      protected void listChildren(List<Property> childrenList) {
638        super.listChildren(childrenList);
639        childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
640        childrenList.add(new Property("status", "code", "The status of the resource instance.", 0, java.lang.Integer.MAX_VALUE, status));
641        childrenList.add(new Property("created", "dateTime", "The date when this resource was created.", 0, java.lang.Integer.MAX_VALUE, created));
642        childrenList.add(new Property("insurer", "Reference(Organization)", "The Insurer who is target  of the request.", 0, java.lang.Integer.MAX_VALUE, insurer));
643        childrenList.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
644        childrenList.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, organization));
645        childrenList.add(new Property("subject", "Reference(Patient)", "Patient Resource.", 0, java.lang.Integer.MAX_VALUE, subject));
646        childrenList.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, coverage));
647      }
648
649      @Override
650      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
651        switch (hash) {
652        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
653        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EnrollmentRequestStatus>
654        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
655        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
656        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
657        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
658        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
659        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
660        default: return super.getProperty(hash, name, checkValid);
661        }
662
663      }
664
665      @Override
666      public Base setProperty(int hash, String name, Base value) throws FHIRException {
667        switch (hash) {
668        case -1618432855: // identifier
669          this.getIdentifier().add(castToIdentifier(value)); // Identifier
670          return value;
671        case -892481550: // status
672          value = new EnrollmentRequestStatusEnumFactory().fromType(castToCode(value));
673          this.status = (Enumeration) value; // Enumeration<EnrollmentRequestStatus>
674          return value;
675        case 1028554472: // created
676          this.created = castToDateTime(value); // DateTimeType
677          return value;
678        case 1957615864: // insurer
679          this.insurer = castToReference(value); // Reference
680          return value;
681        case -987494927: // provider
682          this.provider = castToReference(value); // Reference
683          return value;
684        case 1178922291: // organization
685          this.organization = castToReference(value); // Reference
686          return value;
687        case -1867885268: // subject
688          this.subject = castToReference(value); // Reference
689          return value;
690        case -351767064: // coverage
691          this.coverage = castToReference(value); // Reference
692          return value;
693        default: return super.setProperty(hash, name, value);
694        }
695
696      }
697
698      @Override
699      public Base setProperty(String name, Base value) throws FHIRException {
700        if (name.equals("identifier")) {
701          this.getIdentifier().add(castToIdentifier(value));
702        } else if (name.equals("status")) {
703          value = new EnrollmentRequestStatusEnumFactory().fromType(castToCode(value));
704          this.status = (Enumeration) value; // Enumeration<EnrollmentRequestStatus>
705        } else if (name.equals("created")) {
706          this.created = castToDateTime(value); // DateTimeType
707        } else if (name.equals("insurer")) {
708          this.insurer = castToReference(value); // Reference
709        } else if (name.equals("provider")) {
710          this.provider = castToReference(value); // Reference
711        } else if (name.equals("organization")) {
712          this.organization = castToReference(value); // Reference
713        } else if (name.equals("subject")) {
714          this.subject = castToReference(value); // Reference
715        } else if (name.equals("coverage")) {
716          this.coverage = castToReference(value); // Reference
717        } else
718          return super.setProperty(name, value);
719        return value;
720      }
721
722      @Override
723      public Base makeProperty(int hash, String name) throws FHIRException {
724        switch (hash) {
725        case -1618432855:  return addIdentifier(); 
726        case -892481550:  return getStatusElement();
727        case 1028554472:  return getCreatedElement();
728        case 1957615864:  return getInsurer(); 
729        case -987494927:  return getProvider(); 
730        case 1178922291:  return getOrganization(); 
731        case -1867885268:  return getSubject(); 
732        case -351767064:  return getCoverage(); 
733        default: return super.makeProperty(hash, name);
734        }
735
736      }
737
738      @Override
739      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
740        switch (hash) {
741        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
742        case -892481550: /*status*/ return new String[] {"code"};
743        case 1028554472: /*created*/ return new String[] {"dateTime"};
744        case 1957615864: /*insurer*/ return new String[] {"Reference"};
745        case -987494927: /*provider*/ return new String[] {"Reference"};
746        case 1178922291: /*organization*/ return new String[] {"Reference"};
747        case -1867885268: /*subject*/ return new String[] {"Reference"};
748        case -351767064: /*coverage*/ return new String[] {"Reference"};
749        default: return super.getTypesForProperty(hash, name);
750        }
751
752      }
753
754      @Override
755      public Base addChild(String name) throws FHIRException {
756        if (name.equals("identifier")) {
757          return addIdentifier();
758        }
759        else if (name.equals("status")) {
760          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentRequest.status");
761        }
762        else if (name.equals("created")) {
763          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentRequest.created");
764        }
765        else if (name.equals("insurer")) {
766          this.insurer = new Reference();
767          return this.insurer;
768        }
769        else if (name.equals("provider")) {
770          this.provider = new Reference();
771          return this.provider;
772        }
773        else if (name.equals("organization")) {
774          this.organization = new Reference();
775          return this.organization;
776        }
777        else if (name.equals("subject")) {
778          this.subject = new Reference();
779          return this.subject;
780        }
781        else if (name.equals("coverage")) {
782          this.coverage = new Reference();
783          return this.coverage;
784        }
785        else
786          return super.addChild(name);
787      }
788
789  public String fhirType() {
790    return "EnrollmentRequest";
791
792  }
793
794      public EnrollmentRequest copy() {
795        EnrollmentRequest dst = new EnrollmentRequest();
796        copyValues(dst);
797        if (identifier != null) {
798          dst.identifier = new ArrayList<Identifier>();
799          for (Identifier i : identifier)
800            dst.identifier.add(i.copy());
801        };
802        dst.status = status == null ? null : status.copy();
803        dst.created = created == null ? null : created.copy();
804        dst.insurer = insurer == null ? null : insurer.copy();
805        dst.provider = provider == null ? null : provider.copy();
806        dst.organization = organization == null ? null : organization.copy();
807        dst.subject = subject == null ? null : subject.copy();
808        dst.coverage = coverage == null ? null : coverage.copy();
809        return dst;
810      }
811
812      protected EnrollmentRequest typedCopy() {
813        return copy();
814      }
815
816      @Override
817      public boolean equalsDeep(Base other) {
818        if (!super.equalsDeep(other))
819          return false;
820        if (!(other instanceof EnrollmentRequest))
821          return false;
822        EnrollmentRequest o = (EnrollmentRequest) other;
823        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(created, o.created, true)
824           && compareDeep(insurer, o.insurer, true) && compareDeep(provider, o.provider, true) && compareDeep(organization, o.organization, true)
825           && compareDeep(subject, o.subject, true) && compareDeep(coverage, o.coverage, true);
826      }
827
828      @Override
829      public boolean equalsShallow(Base other) {
830        if (!super.equalsShallow(other))
831          return false;
832        if (!(other instanceof EnrollmentRequest))
833          return false;
834        EnrollmentRequest o = (EnrollmentRequest) other;
835        return compareValues(status, o.status, true) && compareValues(created, o.created, true);
836      }
837
838      public boolean isEmpty() {
839        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, created
840          , insurer, provider, organization, subject, coverage);
841      }
842
843  @Override
844  public ResourceType getResourceType() {
845    return ResourceType.EnrollmentRequest;
846   }
847
848 /**
849   * Search parameter: <b>identifier</b>
850   * <p>
851   * Description: <b>The business identifier of the Enrollment</b><br>
852   * Type: <b>token</b><br>
853   * Path: <b>EnrollmentRequest.identifier</b><br>
854   * </p>
855   */
856  @SearchParamDefinition(name="identifier", path="EnrollmentRequest.identifier", description="The business identifier of the Enrollment", type="token" )
857  public static final String SP_IDENTIFIER = "identifier";
858 /**
859   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
860   * <p>
861   * Description: <b>The business identifier of the Enrollment</b><br>
862   * Type: <b>token</b><br>
863   * Path: <b>EnrollmentRequest.identifier</b><br>
864   * </p>
865   */
866  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
867
868 /**
869   * Search parameter: <b>subject</b>
870   * <p>
871   * Description: <b>The party to be enrolled</b><br>
872   * Type: <b>reference</b><br>
873   * Path: <b>EnrollmentRequest.subject</b><br>
874   * </p>
875   */
876  @SearchParamDefinition(name="subject", path="EnrollmentRequest.subject", description="The party to be enrolled", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
877  public static final String SP_SUBJECT = "subject";
878 /**
879   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
880   * <p>
881   * Description: <b>The party to be enrolled</b><br>
882   * Type: <b>reference</b><br>
883   * Path: <b>EnrollmentRequest.subject</b><br>
884   * </p>
885   */
886  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
887
888/**
889   * Constant for fluent queries to be used to add include statements. Specifies
890   * the path value of "<b>EnrollmentRequest:subject</b>".
891   */
892  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("EnrollmentRequest:subject").toLocked();
893
894 /**
895   * Search parameter: <b>patient</b>
896   * <p>
897   * Description: <b>The party to be enrolled</b><br>
898   * Type: <b>reference</b><br>
899   * Path: <b>EnrollmentRequest.subject</b><br>
900   * </p>
901   */
902  @SearchParamDefinition(name="patient", path="EnrollmentRequest.subject", description="The party to be enrolled", type="reference", target={Patient.class } )
903  public static final String SP_PATIENT = "patient";
904 /**
905   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
906   * <p>
907   * Description: <b>The party to be enrolled</b><br>
908   * Type: <b>reference</b><br>
909   * Path: <b>EnrollmentRequest.subject</b><br>
910   * </p>
911   */
912  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
913
914/**
915   * Constant for fluent queries to be used to add include statements. Specifies
916   * the path value of "<b>EnrollmentRequest:patient</b>".
917   */
918  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("EnrollmentRequest:patient").toLocked();
919
920 /**
921   * Search parameter: <b>organization</b>
922   * <p>
923   * Description: <b>The organization who generated this resource</b><br>
924   * Type: <b>reference</b><br>
925   * Path: <b>EnrollmentRequest.organization</b><br>
926   * </p>
927   */
928  @SearchParamDefinition(name="organization", path="EnrollmentRequest.organization", description="The organization who generated this resource", type="reference", target={Organization.class } )
929  public static final String SP_ORGANIZATION = "organization";
930 /**
931   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
932   * <p>
933   * Description: <b>The organization who generated this resource</b><br>
934   * Type: <b>reference</b><br>
935   * Path: <b>EnrollmentRequest.organization</b><br>
936   * </p>
937   */
938  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
939
940/**
941   * Constant for fluent queries to be used to add include statements. Specifies
942   * the path value of "<b>EnrollmentRequest:organization</b>".
943   */
944  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("EnrollmentRequest:organization").toLocked();
945
946
947}
948