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