001package org.hl7.fhir.dstu2016may.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 Sun, May 8, 2016 03:05+1000 for FHIR v1.4.0
033import java.util.ArrayList;
034import java.util.Date;
035import java.util.List;
036
037import org.hl7.fhir.exceptions.FHIRException;
038
039import ca.uhn.fhir.model.api.annotation.Child;
040import ca.uhn.fhir.model.api.annotation.Description;
041import ca.uhn.fhir.model.api.annotation.ResourceDef;
042import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
043/**
044 * This resource provides the insurance enrollment details to the insurer regarding a specified coverage.
045 */
046@ResourceDef(name="EnrollmentRequest", profile="http://hl7.org/fhir/Profile/EnrollmentRequest")
047public class EnrollmentRequest extends DomainResource {
048
049    /**
050     * The Response business identifier.
051     */
052    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
053    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
054    protected List<Identifier> identifier;
055
056    /**
057     * The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
058     */
059    @Child(name = "ruleset", type = {Coding.class}, order=1, min=0, max=1, modifier=false, summary=true)
060    @Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
061    protected Coding ruleset;
062
063    /**
064     * The style (standard) and version of the original material which was converted into this resource.
065     */
066    @Child(name = "originalRuleset", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
067    @Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
068    protected Coding originalRuleset;
069
070    /**
071     * The date when this resource was created.
072     */
073    @Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=true)
074    @Description(shortDefinition="Creation date", formalDefinition="The date when this resource was created." )
075    protected DateTimeType created;
076
077    /**
078     * The Insurer who is target  of the request.
079     */
080    @Child(name = "target", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=true)
081    @Description(shortDefinition="Insurer", formalDefinition="The Insurer who is target  of the request." )
082    protected Reference target;
083
084    /**
085     * The actual object that is the target of the reference (The Insurer who is target  of the request.)
086     */
087    protected Organization targetTarget;
088
089    /**
090     * The practitioner who is responsible for the services rendered to the patient.
091     */
092    @Child(name = "provider", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=true)
093    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
094    protected Reference provider;
095
096    /**
097     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
098     */
099    protected Practitioner providerTarget;
100
101    /**
102     * The organization which is responsible for the services rendered to the patient.
103     */
104    @Child(name = "organization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=true)
105    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
106    protected Reference organization;
107
108    /**
109     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
110     */
111    protected Organization organizationTarget;
112
113    /**
114     * Patient Resource.
115     */
116    @Child(name = "subject", type = {Patient.class}, order=7, min=1, max=1, modifier=false, summary=true)
117    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
118    protected Reference subject;
119
120    /**
121     * The actual object that is the target of the reference (Patient Resource.)
122     */
123    protected Patient subjectTarget;
124
125    /**
126     * Reference to the program or plan identification, underwriter or payor.
127     */
128    @Child(name = "coverage", type = {Coverage.class}, order=8, min=1, max=1, modifier=false, summary=true)
129    @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
130    protected Reference coverage;
131
132    /**
133     * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
134     */
135    protected Coverage coverageTarget;
136
137    /**
138     * The relationship of the patient to the subscriber.
139     */
140    @Child(name = "relationship", type = {Coding.class}, order=9, min=1, max=1, modifier=false, summary=true)
141    @Description(shortDefinition="Patient relationship to subscriber", formalDefinition="The relationship of the patient to the subscriber." )
142    protected Coding relationship;
143
144    private static final long serialVersionUID = -1656505325L;
145
146  /**
147   * Constructor
148   */
149    public EnrollmentRequest() {
150      super();
151    }
152
153  /**
154   * Constructor
155   */
156    public EnrollmentRequest(Reference subject, Reference coverage, Coding relationship) {
157      super();
158      this.subject = subject;
159      this.coverage = coverage;
160      this.relationship = relationship;
161    }
162
163    /**
164     * @return {@link #identifier} (The Response business identifier.)
165     */
166    public List<Identifier> getIdentifier() { 
167      if (this.identifier == null)
168        this.identifier = new ArrayList<Identifier>();
169      return this.identifier;
170    }
171
172    public boolean hasIdentifier() { 
173      if (this.identifier == null)
174        return false;
175      for (Identifier item : this.identifier)
176        if (!item.isEmpty())
177          return true;
178      return false;
179    }
180
181    /**
182     * @return {@link #identifier} (The Response business identifier.)
183     */
184    // syntactic sugar
185    public Identifier addIdentifier() { //3
186      Identifier t = new Identifier();
187      if (this.identifier == null)
188        this.identifier = new ArrayList<Identifier>();
189      this.identifier.add(t);
190      return t;
191    }
192
193    // syntactic sugar
194    public EnrollmentRequest addIdentifier(Identifier t) { //3
195      if (t == null)
196        return this;
197      if (this.identifier == null)
198        this.identifier = new ArrayList<Identifier>();
199      this.identifier.add(t);
200      return this;
201    }
202
203    /**
204     * @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
205     */
206    public Coding getRuleset() { 
207      if (this.ruleset == null)
208        if (Configuration.errorOnAutoCreate())
209          throw new Error("Attempt to auto-create EnrollmentRequest.ruleset");
210        else if (Configuration.doAutoCreate())
211          this.ruleset = new Coding(); // cc
212      return this.ruleset;
213    }
214
215    public boolean hasRuleset() { 
216      return this.ruleset != null && !this.ruleset.isEmpty();
217    }
218
219    /**
220     * @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
221     */
222    public EnrollmentRequest setRuleset(Coding value) { 
223      this.ruleset = value;
224      return this;
225    }
226
227    /**
228     * @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
229     */
230    public Coding getOriginalRuleset() { 
231      if (this.originalRuleset == null)
232        if (Configuration.errorOnAutoCreate())
233          throw new Error("Attempt to auto-create EnrollmentRequest.originalRuleset");
234        else if (Configuration.doAutoCreate())
235          this.originalRuleset = new Coding(); // cc
236      return this.originalRuleset;
237    }
238
239    public boolean hasOriginalRuleset() { 
240      return this.originalRuleset != null && !this.originalRuleset.isEmpty();
241    }
242
243    /**
244     * @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
245     */
246    public EnrollmentRequest setOriginalRuleset(Coding value) { 
247      this.originalRuleset = value;
248      return this;
249    }
250
251    /**
252     * @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
253     */
254    public DateTimeType getCreatedElement() { 
255      if (this.created == null)
256        if (Configuration.errorOnAutoCreate())
257          throw new Error("Attempt to auto-create EnrollmentRequest.created");
258        else if (Configuration.doAutoCreate())
259          this.created = new DateTimeType(); // bb
260      return this.created;
261    }
262
263    public boolean hasCreatedElement() { 
264      return this.created != null && !this.created.isEmpty();
265    }
266
267    public boolean hasCreated() { 
268      return this.created != null && !this.created.isEmpty();
269    }
270
271    /**
272     * @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
273     */
274    public EnrollmentRequest setCreatedElement(DateTimeType value) { 
275      this.created = value;
276      return this;
277    }
278
279    /**
280     * @return The date when this resource was created.
281     */
282    public Date getCreated() { 
283      return this.created == null ? null : this.created.getValue();
284    }
285
286    /**
287     * @param value The date when this resource was created.
288     */
289    public EnrollmentRequest setCreated(Date value) { 
290      if (value == null)
291        this.created = null;
292      else {
293        if (this.created == null)
294          this.created = new DateTimeType();
295        this.created.setValue(value);
296      }
297      return this;
298    }
299
300    /**
301     * @return {@link #target} (The Insurer who is target  of the request.)
302     */
303    public Reference getTarget() { 
304      if (this.target == null)
305        if (Configuration.errorOnAutoCreate())
306          throw new Error("Attempt to auto-create EnrollmentRequest.target");
307        else if (Configuration.doAutoCreate())
308          this.target = new Reference(); // cc
309      return this.target;
310    }
311
312    public boolean hasTarget() { 
313      return this.target != null && !this.target.isEmpty();
314    }
315
316    /**
317     * @param value {@link #target} (The Insurer who is target  of the request.)
318     */
319    public EnrollmentRequest setTarget(Reference value) { 
320      this.target = value;
321      return this;
322    }
323
324    /**
325     * @return {@link #target} 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.)
326     */
327    public Organization getTargetTarget() { 
328      if (this.targetTarget == null)
329        if (Configuration.errorOnAutoCreate())
330          throw new Error("Attempt to auto-create EnrollmentRequest.target");
331        else if (Configuration.doAutoCreate())
332          this.targetTarget = new Organization(); // aa
333      return this.targetTarget;
334    }
335
336    /**
337     * @param value {@link #target} 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.)
338     */
339    public EnrollmentRequest setTargetTarget(Organization value) { 
340      this.targetTarget = value;
341      return this;
342    }
343
344    /**
345     * @return {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
346     */
347    public Reference getProvider() { 
348      if (this.provider == null)
349        if (Configuration.errorOnAutoCreate())
350          throw new Error("Attempt to auto-create EnrollmentRequest.provider");
351        else if (Configuration.doAutoCreate())
352          this.provider = new Reference(); // cc
353      return this.provider;
354    }
355
356    public boolean hasProvider() { 
357      return this.provider != null && !this.provider.isEmpty();
358    }
359
360    /**
361     * @param value {@link #provider} (The practitioner who is responsible for the services rendered to the patient.)
362     */
363    public EnrollmentRequest setProvider(Reference value) { 
364      this.provider = value;
365      return this;
366    }
367
368    /**
369     * @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.)
370     */
371    public Practitioner getProviderTarget() { 
372      if (this.providerTarget == null)
373        if (Configuration.errorOnAutoCreate())
374          throw new Error("Attempt to auto-create EnrollmentRequest.provider");
375        else if (Configuration.doAutoCreate())
376          this.providerTarget = new Practitioner(); // aa
377      return this.providerTarget;
378    }
379
380    /**
381     * @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.)
382     */
383    public EnrollmentRequest setProviderTarget(Practitioner value) { 
384      this.providerTarget = value;
385      return this;
386    }
387
388    /**
389     * @return {@link #organization} (The organization which is responsible for the services rendered to the patient.)
390     */
391    public Reference getOrganization() { 
392      if (this.organization == null)
393        if (Configuration.errorOnAutoCreate())
394          throw new Error("Attempt to auto-create EnrollmentRequest.organization");
395        else if (Configuration.doAutoCreate())
396          this.organization = new Reference(); // cc
397      return this.organization;
398    }
399
400    public boolean hasOrganization() { 
401      return this.organization != null && !this.organization.isEmpty();
402    }
403
404    /**
405     * @param value {@link #organization} (The organization which is responsible for the services rendered to the patient.)
406     */
407    public EnrollmentRequest setOrganization(Reference value) { 
408      this.organization = value;
409      return this;
410    }
411
412    /**
413     * @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.)
414     */
415    public Organization getOrganizationTarget() { 
416      if (this.organizationTarget == null)
417        if (Configuration.errorOnAutoCreate())
418          throw new Error("Attempt to auto-create EnrollmentRequest.organization");
419        else if (Configuration.doAutoCreate())
420          this.organizationTarget = new Organization(); // aa
421      return this.organizationTarget;
422    }
423
424    /**
425     * @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.)
426     */
427    public EnrollmentRequest setOrganizationTarget(Organization value) { 
428      this.organizationTarget = value;
429      return this;
430    }
431
432    /**
433     * @return {@link #subject} (Patient Resource.)
434     */
435    public Reference getSubject() { 
436      if (this.subject == null)
437        if (Configuration.errorOnAutoCreate())
438          throw new Error("Attempt to auto-create EnrollmentRequest.subject");
439        else if (Configuration.doAutoCreate())
440          this.subject = new Reference(); // cc
441      return this.subject;
442    }
443
444    public boolean hasSubject() { 
445      return this.subject != null && !this.subject.isEmpty();
446    }
447
448    /**
449     * @param value {@link #subject} (Patient Resource.)
450     */
451    public EnrollmentRequest setSubject(Reference value) { 
452      this.subject = value;
453      return this;
454    }
455
456    /**
457     * @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.)
458     */
459    public Patient getSubjectTarget() { 
460      if (this.subjectTarget == null)
461        if (Configuration.errorOnAutoCreate())
462          throw new Error("Attempt to auto-create EnrollmentRequest.subject");
463        else if (Configuration.doAutoCreate())
464          this.subjectTarget = new Patient(); // aa
465      return this.subjectTarget;
466    }
467
468    /**
469     * @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.)
470     */
471    public EnrollmentRequest setSubjectTarget(Patient value) { 
472      this.subjectTarget = value;
473      return this;
474    }
475
476    /**
477     * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
478     */
479    public Reference getCoverage() { 
480      if (this.coverage == null)
481        if (Configuration.errorOnAutoCreate())
482          throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
483        else if (Configuration.doAutoCreate())
484          this.coverage = new Reference(); // cc
485      return this.coverage;
486    }
487
488    public boolean hasCoverage() { 
489      return this.coverage != null && !this.coverage.isEmpty();
490    }
491
492    /**
493     * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
494     */
495    public EnrollmentRequest setCoverage(Reference value) { 
496      this.coverage = value;
497      return this;
498    }
499
500    /**
501     * @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.)
502     */
503    public Coverage getCoverageTarget() { 
504      if (this.coverageTarget == null)
505        if (Configuration.errorOnAutoCreate())
506          throw new Error("Attempt to auto-create EnrollmentRequest.coverage");
507        else if (Configuration.doAutoCreate())
508          this.coverageTarget = new Coverage(); // aa
509      return this.coverageTarget;
510    }
511
512    /**
513     * @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.)
514     */
515    public EnrollmentRequest setCoverageTarget(Coverage value) { 
516      this.coverageTarget = value;
517      return this;
518    }
519
520    /**
521     * @return {@link #relationship} (The relationship of the patient to the subscriber.)
522     */
523    public Coding getRelationship() { 
524      if (this.relationship == null)
525        if (Configuration.errorOnAutoCreate())
526          throw new Error("Attempt to auto-create EnrollmentRequest.relationship");
527        else if (Configuration.doAutoCreate())
528          this.relationship = new Coding(); // cc
529      return this.relationship;
530    }
531
532    public boolean hasRelationship() { 
533      return this.relationship != null && !this.relationship.isEmpty();
534    }
535
536    /**
537     * @param value {@link #relationship} (The relationship of the patient to the subscriber.)
538     */
539    public EnrollmentRequest setRelationship(Coding value) { 
540      this.relationship = value;
541      return this;
542    }
543
544      protected void listChildren(List<Property> childrenList) {
545        super.listChildren(childrenList);
546        childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
547        childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
548        childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
549        childrenList.add(new Property("created", "dateTime", "The date when this resource was created.", 0, java.lang.Integer.MAX_VALUE, created));
550        childrenList.add(new Property("target", "Reference(Organization)", "The Insurer who is target  of the request.", 0, java.lang.Integer.MAX_VALUE, target));
551        childrenList.add(new Property("provider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, provider));
552        childrenList.add(new Property("organization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, organization));
553        childrenList.add(new Property("subject", "Reference(Patient)", "Patient Resource.", 0, java.lang.Integer.MAX_VALUE, subject));
554        childrenList.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, coverage));
555        childrenList.add(new Property("relationship", "Coding", "The relationship of the patient to the subscriber.", 0, java.lang.Integer.MAX_VALUE, relationship));
556      }
557
558      @Override
559      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
560        switch (hash) {
561        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
562        case 1548678118: /*ruleset*/ return this.ruleset == null ? new Base[0] : new Base[] {this.ruleset}; // Coding
563        case 1089373397: /*originalRuleset*/ return this.originalRuleset == null ? new Base[0] : new Base[] {this.originalRuleset}; // Coding
564        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
565        case -880905839: /*target*/ return this.target == null ? new Base[0] : new Base[] {this.target}; // Reference
566        case -987494927: /*provider*/ return this.provider == null ? new Base[0] : new Base[] {this.provider}; // Reference
567        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
568        case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference
569        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
570        case -261851592: /*relationship*/ return this.relationship == null ? new Base[0] : new Base[] {this.relationship}; // Coding
571        default: return super.getProperty(hash, name, checkValid);
572        }
573
574      }
575
576      @Override
577      public void setProperty(int hash, String name, Base value) throws FHIRException {
578        switch (hash) {
579        case -1618432855: // identifier
580          this.getIdentifier().add(castToIdentifier(value)); // Identifier
581          break;
582        case 1548678118: // ruleset
583          this.ruleset = castToCoding(value); // Coding
584          break;
585        case 1089373397: // originalRuleset
586          this.originalRuleset = castToCoding(value); // Coding
587          break;
588        case 1028554472: // created
589          this.created = castToDateTime(value); // DateTimeType
590          break;
591        case -880905839: // target
592          this.target = castToReference(value); // Reference
593          break;
594        case -987494927: // provider
595          this.provider = castToReference(value); // Reference
596          break;
597        case 1178922291: // organization
598          this.organization = castToReference(value); // Reference
599          break;
600        case -1867885268: // subject
601          this.subject = castToReference(value); // Reference
602          break;
603        case -351767064: // coverage
604          this.coverage = castToReference(value); // Reference
605          break;
606        case -261851592: // relationship
607          this.relationship = castToCoding(value); // Coding
608          break;
609        default: super.setProperty(hash, name, value);
610        }
611
612      }
613
614      @Override
615      public void setProperty(String name, Base value) throws FHIRException {
616        if (name.equals("identifier"))
617          this.getIdentifier().add(castToIdentifier(value));
618        else if (name.equals("ruleset"))
619          this.ruleset = castToCoding(value); // Coding
620        else if (name.equals("originalRuleset"))
621          this.originalRuleset = castToCoding(value); // Coding
622        else if (name.equals("created"))
623          this.created = castToDateTime(value); // DateTimeType
624        else if (name.equals("target"))
625          this.target = castToReference(value); // Reference
626        else if (name.equals("provider"))
627          this.provider = castToReference(value); // Reference
628        else if (name.equals("organization"))
629          this.organization = castToReference(value); // Reference
630        else if (name.equals("subject"))
631          this.subject = castToReference(value); // Reference
632        else if (name.equals("coverage"))
633          this.coverage = castToReference(value); // Reference
634        else if (name.equals("relationship"))
635          this.relationship = castToCoding(value); // Coding
636        else
637          super.setProperty(name, value);
638      }
639
640      @Override
641      public Base makeProperty(int hash, String name) throws FHIRException {
642        switch (hash) {
643        case -1618432855:  return addIdentifier(); // Identifier
644        case 1548678118:  return getRuleset(); // Coding
645        case 1089373397:  return getOriginalRuleset(); // Coding
646        case 1028554472: throw new FHIRException("Cannot make property created as it is not a complex type"); // DateTimeType
647        case -880905839:  return getTarget(); // Reference
648        case -987494927:  return getProvider(); // Reference
649        case 1178922291:  return getOrganization(); // Reference
650        case -1867885268:  return getSubject(); // Reference
651        case -351767064:  return getCoverage(); // Reference
652        case -261851592:  return getRelationship(); // Coding
653        default: return super.makeProperty(hash, name);
654        }
655
656      }
657
658      @Override
659      public Base addChild(String name) throws FHIRException {
660        if (name.equals("identifier")) {
661          return addIdentifier();
662        }
663        else if (name.equals("ruleset")) {
664          this.ruleset = new Coding();
665          return this.ruleset;
666        }
667        else if (name.equals("originalRuleset")) {
668          this.originalRuleset = new Coding();
669          return this.originalRuleset;
670        }
671        else if (name.equals("created")) {
672          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentRequest.created");
673        }
674        else if (name.equals("target")) {
675          this.target = new Reference();
676          return this.target;
677        }
678        else if (name.equals("provider")) {
679          this.provider = new Reference();
680          return this.provider;
681        }
682        else if (name.equals("organization")) {
683          this.organization = new Reference();
684          return this.organization;
685        }
686        else if (name.equals("subject")) {
687          this.subject = new Reference();
688          return this.subject;
689        }
690        else if (name.equals("coverage")) {
691          this.coverage = new Reference();
692          return this.coverage;
693        }
694        else if (name.equals("relationship")) {
695          this.relationship = new Coding();
696          return this.relationship;
697        }
698        else
699          return super.addChild(name);
700      }
701
702  public String fhirType() {
703    return "EnrollmentRequest";
704
705  }
706
707      public EnrollmentRequest copy() {
708        EnrollmentRequest dst = new EnrollmentRequest();
709        copyValues(dst);
710        if (identifier != null) {
711          dst.identifier = new ArrayList<Identifier>();
712          for (Identifier i : identifier)
713            dst.identifier.add(i.copy());
714        };
715        dst.ruleset = ruleset == null ? null : ruleset.copy();
716        dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
717        dst.created = created == null ? null : created.copy();
718        dst.target = target == null ? null : target.copy();
719        dst.provider = provider == null ? null : provider.copy();
720        dst.organization = organization == null ? null : organization.copy();
721        dst.subject = subject == null ? null : subject.copy();
722        dst.coverage = coverage == null ? null : coverage.copy();
723        dst.relationship = relationship == null ? null : relationship.copy();
724        return dst;
725      }
726
727      protected EnrollmentRequest typedCopy() {
728        return copy();
729      }
730
731      @Override
732      public boolean equalsDeep(Base other) {
733        if (!super.equalsDeep(other))
734          return false;
735        if (!(other instanceof EnrollmentRequest))
736          return false;
737        EnrollmentRequest o = (EnrollmentRequest) other;
738        return compareDeep(identifier, o.identifier, true) && compareDeep(ruleset, o.ruleset, true) && compareDeep(originalRuleset, o.originalRuleset, true)
739           && compareDeep(created, o.created, true) && compareDeep(target, o.target, true) && compareDeep(provider, o.provider, true)
740           && compareDeep(organization, o.organization, true) && compareDeep(subject, o.subject, true) && compareDeep(coverage, o.coverage, true)
741           && compareDeep(relationship, o.relationship, true);
742      }
743
744      @Override
745      public boolean equalsShallow(Base other) {
746        if (!super.equalsShallow(other))
747          return false;
748        if (!(other instanceof EnrollmentRequest))
749          return false;
750        EnrollmentRequest o = (EnrollmentRequest) other;
751        return compareValues(created, o.created, true);
752      }
753
754      public boolean isEmpty() {
755        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (ruleset == null || ruleset.isEmpty())
756           && (originalRuleset == null || originalRuleset.isEmpty()) && (created == null || created.isEmpty())
757           && (target == null || target.isEmpty()) && (provider == null || provider.isEmpty()) && (organization == null || organization.isEmpty())
758           && (subject == null || subject.isEmpty()) && (coverage == null || coverage.isEmpty()) && (relationship == null || relationship.isEmpty())
759          ;
760      }
761
762  @Override
763  public ResourceType getResourceType() {
764    return ResourceType.EnrollmentRequest;
765   }
766
767 /**
768   * Search parameter: <b>patient</b>
769   * <p>
770   * Description: <b>The party to be enrolled</b><br>
771   * Type: <b>reference</b><br>
772   * Path: <b>EnrollmentRequest.subject</b><br>
773   * </p>
774   */
775  @SearchParamDefinition(name="patient", path="EnrollmentRequest.subject", description="The party to be enrolled", type="reference" )
776  public static final String SP_PATIENT = "patient";
777 /**
778   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
779   * <p>
780   * Description: <b>The party to be enrolled</b><br>
781   * Type: <b>reference</b><br>
782   * Path: <b>EnrollmentRequest.subject</b><br>
783   * </p>
784   */
785  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
786
787/**
788   * Constant for fluent queries to be used to add include statements. Specifies
789   * the path value of "<b>EnrollmentRequest:patient</b>".
790   */
791  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("EnrollmentRequest:patient").toLocked();
792
793 /**
794   * Search parameter: <b>subject</b>
795   * <p>
796   * Description: <b>The party to be enrolled</b><br>
797   * Type: <b>reference</b><br>
798   * Path: <b>EnrollmentRequest.subject</b><br>
799   * </p>
800   */
801  @SearchParamDefinition(name="subject", path="EnrollmentRequest.subject", description="The party to be enrolled", type="reference" )
802  public static final String SP_SUBJECT = "subject";
803 /**
804   * <b>Fluent Client</b> search parameter constant for <b>subject</b>
805   * <p>
806   * Description: <b>The party to be enrolled</b><br>
807   * Type: <b>reference</b><br>
808   * Path: <b>EnrollmentRequest.subject</b><br>
809   * </p>
810   */
811  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT);
812
813/**
814   * Constant for fluent queries to be used to add include statements. Specifies
815   * the path value of "<b>EnrollmentRequest:subject</b>".
816   */
817  public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("EnrollmentRequest:subject").toLocked();
818
819 /**
820   * Search parameter: <b>identifier</b>
821   * <p>
822   * Description: <b>The business identifier of the Enrollment</b><br>
823   * Type: <b>token</b><br>
824   * Path: <b>EnrollmentRequest.identifier</b><br>
825   * </p>
826   */
827  @SearchParamDefinition(name="identifier", path="EnrollmentRequest.identifier", description="The business identifier of the Enrollment", type="token" )
828  public static final String SP_IDENTIFIER = "identifier";
829 /**
830   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
831   * <p>
832   * Description: <b>The business identifier of the Enrollment</b><br>
833   * Type: <b>token</b><br>
834   * Path: <b>EnrollmentRequest.identifier</b><br>
835   * </p>
836   */
837  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
838
839
840}
841