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