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