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