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