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