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