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 org.hl7.fhir.r5.model.Enumerations.*;
062import ca.uhn.fhir.model.api.annotation.ResourceDef;
063import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
064import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
065import ca.uhn.fhir.model.api.annotation.Child;
066import ca.uhn.fhir.model.api.annotation.ChildOrder;
067import ca.uhn.fhir.model.api.annotation.Description;
068import ca.uhn.fhir.model.api.annotation.Block;
069/**
070 * This resource provides enrollment and plan details from the processing of an EnrollmentRequest resource.
071 */
072@ResourceDef(name="EnrollmentResponse", profile="http://hl7.org/fhir/StructureDefinition/EnrollmentResponse")
073public class EnrollmentResponse extends DomainResource {
074
075    public enum EnrollmentResponseStatus {
076        /**
077         * The instance is currently in-force.
078         */
079        ACTIVE, 
080        /**
081         * The instance is withdrawn, rescinded or reversed.
082         */
083        CANCELLED, 
084        /**
085         * A new instance the contents of which is not complete.
086         */
087        DRAFT, 
088        /**
089         * The instance was entered in error.
090         */
091        ENTEREDINERROR, 
092        /**
093         * added to help the parsers with the generic types
094         */
095        NULL;
096        public static EnrollmentResponseStatus fromCode(String codeString) throws FHIRException {
097            if (codeString == null || "".equals(codeString))
098                return null;
099        if ("active".equals(codeString))
100          return ACTIVE;
101        if ("cancelled".equals(codeString))
102          return CANCELLED;
103        if ("draft".equals(codeString))
104          return DRAFT;
105        if ("entered-in-error".equals(codeString))
106          return ENTEREDINERROR;
107        if (Configuration.isAcceptInvalidEnums())
108          return null;
109        else
110          throw new FHIRException("Unknown EnrollmentResponseStatus code '"+codeString+"'");
111        }
112        public String toCode() {
113          switch (this) {
114            case ACTIVE: return "active";
115            case CANCELLED: return "cancelled";
116            case DRAFT: return "draft";
117            case ENTEREDINERROR: return "entered-in-error";
118            default: return "?";
119          }
120        }
121        public String getSystem() {
122          switch (this) {
123            case ACTIVE: return "http://hl7.org/fhir/fm-status";
124            case CANCELLED: return "http://hl7.org/fhir/fm-status";
125            case DRAFT: return "http://hl7.org/fhir/fm-status";
126            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
127            default: return "?";
128          }
129        }
130        public String getDefinition() {
131          switch (this) {
132            case ACTIVE: return "The instance is currently in-force.";
133            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
134            case DRAFT: return "A new instance the contents of which is not complete.";
135            case ENTEREDINERROR: return "The instance was entered in error.";
136            default: return "?";
137          }
138        }
139        public String getDisplay() {
140          switch (this) {
141            case ACTIVE: return "Active";
142            case CANCELLED: return "Cancelled";
143            case DRAFT: return "Draft";
144            case ENTEREDINERROR: return "Entered in Error";
145            default: return "?";
146          }
147        }
148    }
149
150  public static class EnrollmentResponseStatusEnumFactory implements EnumFactory<EnrollmentResponseStatus> {
151    public EnrollmentResponseStatus fromCode(String codeString) throws IllegalArgumentException {
152      if (codeString == null || "".equals(codeString))
153            if (codeString == null || "".equals(codeString))
154                return null;
155        if ("active".equals(codeString))
156          return EnrollmentResponseStatus.ACTIVE;
157        if ("cancelled".equals(codeString))
158          return EnrollmentResponseStatus.CANCELLED;
159        if ("draft".equals(codeString))
160          return EnrollmentResponseStatus.DRAFT;
161        if ("entered-in-error".equals(codeString))
162          return EnrollmentResponseStatus.ENTEREDINERROR;
163        throw new IllegalArgumentException("Unknown EnrollmentResponseStatus code '"+codeString+"'");
164        }
165        public Enumeration<EnrollmentResponseStatus> fromType(Base code) throws FHIRException {
166          if (code == null)
167            return null;
168          if (code.isEmpty())
169            return new Enumeration<EnrollmentResponseStatus>(this);
170          String codeString = ((PrimitiveType) code).asStringValue();
171          if (codeString == null || "".equals(codeString))
172            return null;
173        if ("active".equals(codeString))
174          return new Enumeration<EnrollmentResponseStatus>(this, EnrollmentResponseStatus.ACTIVE);
175        if ("cancelled".equals(codeString))
176          return new Enumeration<EnrollmentResponseStatus>(this, EnrollmentResponseStatus.CANCELLED);
177        if ("draft".equals(codeString))
178          return new Enumeration<EnrollmentResponseStatus>(this, EnrollmentResponseStatus.DRAFT);
179        if ("entered-in-error".equals(codeString))
180          return new Enumeration<EnrollmentResponseStatus>(this, EnrollmentResponseStatus.ENTEREDINERROR);
181        throw new FHIRException("Unknown EnrollmentResponseStatus code '"+codeString+"'");
182        }
183    public String toCode(EnrollmentResponseStatus code) {
184      if (code == EnrollmentResponseStatus.ACTIVE)
185        return "active";
186      if (code == EnrollmentResponseStatus.CANCELLED)
187        return "cancelled";
188      if (code == EnrollmentResponseStatus.DRAFT)
189        return "draft";
190      if (code == EnrollmentResponseStatus.ENTEREDINERROR)
191        return "entered-in-error";
192      return "?";
193      }
194    public String toSystem(EnrollmentResponseStatus code) {
195      return code.getSystem();
196      }
197    }
198
199    /**
200     * The Response business identifier.
201     */
202    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
203    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
204    protected List<Identifier> identifier;
205
206    /**
207     * The status of the resource instance.
208     */
209    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
210    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
211    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
212    protected Enumeration<EnrollmentResponseStatus> status;
213
214    /**
215     * Original request resource reference.
216     */
217    @Child(name = "request", type = {EnrollmentRequest.class}, order=2, min=0, max=1, modifier=false, summary=false)
218    @Description(shortDefinition="Claim reference", formalDefinition="Original request resource reference." )
219    protected Reference request;
220
221    /**
222     * Processing status: error, complete.
223     */
224    @Child(name = "outcome", type = {CodeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
225    @Description(shortDefinition="queued | complete | error | partial", formalDefinition="Processing status: error, complete." )
226    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
227    protected Enumeration<RemittanceOutcome> outcome;
228
229    /**
230     * A description of the status of the adjudication.
231     */
232    @Child(name = "disposition", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
233    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
234    protected StringType disposition;
235
236    /**
237     * The date when the enclosed suite of services were performed or completed.
238     */
239    @Child(name = "created", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
240    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
241    protected DateTimeType created;
242
243    /**
244     * The Insurer who produced this adjudicated response.
245     */
246    @Child(name = "organization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=false)
247    @Description(shortDefinition="Insurer", formalDefinition="The Insurer who produced this adjudicated response." )
248    protected Reference organization;
249
250    /**
251     * The practitioner who is responsible for the services rendered to the patient.
252     */
253    @Child(name = "requestProvider", type = {Practitioner.class, PractitionerRole.class, Organization.class}, order=7, 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 requestProvider;
256
257    private static final long serialVersionUID = -385777247L;
258
259  /**
260   * Constructor
261   */
262    public EnrollmentResponse() {
263      super();
264    }
265
266    /**
267     * @return {@link #identifier} (The Response business identifier.)
268     */
269    public List<Identifier> getIdentifier() { 
270      if (this.identifier == null)
271        this.identifier = new ArrayList<Identifier>();
272      return this.identifier;
273    }
274
275    /**
276     * @return Returns a reference to <code>this</code> for easy method chaining
277     */
278    public EnrollmentResponse setIdentifier(List<Identifier> theIdentifier) { 
279      this.identifier = theIdentifier;
280      return this;
281    }
282
283    public boolean hasIdentifier() { 
284      if (this.identifier == null)
285        return false;
286      for (Identifier item : this.identifier)
287        if (!item.isEmpty())
288          return true;
289      return false;
290    }
291
292    public Identifier addIdentifier() { //3
293      Identifier t = new Identifier();
294      if (this.identifier == null)
295        this.identifier = new ArrayList<Identifier>();
296      this.identifier.add(t);
297      return t;
298    }
299
300    public EnrollmentResponse addIdentifier(Identifier t) { //3
301      if (t == null)
302        return this;
303      if (this.identifier == null)
304        this.identifier = new ArrayList<Identifier>();
305      this.identifier.add(t);
306      return this;
307    }
308
309    /**
310     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
311     */
312    public Identifier getIdentifierFirstRep() { 
313      if (getIdentifier().isEmpty()) {
314        addIdentifier();
315      }
316      return getIdentifier().get(0);
317    }
318
319    /**
320     * @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
321     */
322    public Enumeration<EnrollmentResponseStatus> getStatusElement() { 
323      if (this.status == null)
324        if (Configuration.errorOnAutoCreate())
325          throw new Error("Attempt to auto-create EnrollmentResponse.status");
326        else if (Configuration.doAutoCreate())
327          this.status = new Enumeration<EnrollmentResponseStatus>(new EnrollmentResponseStatusEnumFactory()); // bb
328      return this.status;
329    }
330
331    public boolean hasStatusElement() { 
332      return this.status != null && !this.status.isEmpty();
333    }
334
335    public boolean hasStatus() { 
336      return this.status != null && !this.status.isEmpty();
337    }
338
339    /**
340     * @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
341     */
342    public EnrollmentResponse setStatusElement(Enumeration<EnrollmentResponseStatus> value) { 
343      this.status = value;
344      return this;
345    }
346
347    /**
348     * @return The status of the resource instance.
349     */
350    public EnrollmentResponseStatus getStatus() { 
351      return this.status == null ? null : this.status.getValue();
352    }
353
354    /**
355     * @param value The status of the resource instance.
356     */
357    public EnrollmentResponse setStatus(EnrollmentResponseStatus value) { 
358      if (value == null)
359        this.status = null;
360      else {
361        if (this.status == null)
362          this.status = new Enumeration<EnrollmentResponseStatus>(new EnrollmentResponseStatusEnumFactory());
363        this.status.setValue(value);
364      }
365      return this;
366    }
367
368    /**
369     * @return {@link #request} (Original request resource reference.)
370     */
371    public Reference getRequest() { 
372      if (this.request == null)
373        if (Configuration.errorOnAutoCreate())
374          throw new Error("Attempt to auto-create EnrollmentResponse.request");
375        else if (Configuration.doAutoCreate())
376          this.request = new Reference(); // cc
377      return this.request;
378    }
379
380    public boolean hasRequest() { 
381      return this.request != null && !this.request.isEmpty();
382    }
383
384    /**
385     * @param value {@link #request} (Original request resource reference.)
386     */
387    public EnrollmentResponse setRequest(Reference value) { 
388      this.request = value;
389      return this;
390    }
391
392    /**
393     * @return {@link #outcome} (Processing status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
394     */
395    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
396      if (this.outcome == null)
397        if (Configuration.errorOnAutoCreate())
398          throw new Error("Attempt to auto-create EnrollmentResponse.outcome");
399        else if (Configuration.doAutoCreate())
400          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
401      return this.outcome;
402    }
403
404    public boolean hasOutcomeElement() { 
405      return this.outcome != null && !this.outcome.isEmpty();
406    }
407
408    public boolean hasOutcome() { 
409      return this.outcome != null && !this.outcome.isEmpty();
410    }
411
412    /**
413     * @param value {@link #outcome} (Processing status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
414     */
415    public EnrollmentResponse setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
416      this.outcome = value;
417      return this;
418    }
419
420    /**
421     * @return Processing status: error, complete.
422     */
423    public RemittanceOutcome getOutcome() { 
424      return this.outcome == null ? null : this.outcome.getValue();
425    }
426
427    /**
428     * @param value Processing status: error, complete.
429     */
430    public EnrollmentResponse setOutcome(RemittanceOutcome value) { 
431      if (value == null)
432        this.outcome = null;
433      else {
434        if (this.outcome == null)
435          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
436        this.outcome.setValue(value);
437      }
438      return this;
439    }
440
441    /**
442     * @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
443     */
444    public StringType getDispositionElement() { 
445      if (this.disposition == null)
446        if (Configuration.errorOnAutoCreate())
447          throw new Error("Attempt to auto-create EnrollmentResponse.disposition");
448        else if (Configuration.doAutoCreate())
449          this.disposition = new StringType(); // bb
450      return this.disposition;
451    }
452
453    public boolean hasDispositionElement() { 
454      return this.disposition != null && !this.disposition.isEmpty();
455    }
456
457    public boolean hasDisposition() { 
458      return this.disposition != null && !this.disposition.isEmpty();
459    }
460
461    /**
462     * @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
463     */
464    public EnrollmentResponse setDispositionElement(StringType value) { 
465      this.disposition = value;
466      return this;
467    }
468
469    /**
470     * @return A description of the status of the adjudication.
471     */
472    public String getDisposition() { 
473      return this.disposition == null ? null : this.disposition.getValue();
474    }
475
476    /**
477     * @param value A description of the status of the adjudication.
478     */
479    public EnrollmentResponse setDisposition(String value) { 
480      if (Utilities.noString(value))
481        this.disposition = null;
482      else {
483        if (this.disposition == null)
484          this.disposition = new StringType();
485        this.disposition.setValue(value);
486      }
487      return this;
488    }
489
490    /**
491     * @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
492     */
493    public DateTimeType getCreatedElement() { 
494      if (this.created == null)
495        if (Configuration.errorOnAutoCreate())
496          throw new Error("Attempt to auto-create EnrollmentResponse.created");
497        else if (Configuration.doAutoCreate())
498          this.created = new DateTimeType(); // bb
499      return this.created;
500    }
501
502    public boolean hasCreatedElement() { 
503      return this.created != null && !this.created.isEmpty();
504    }
505
506    public boolean hasCreated() { 
507      return this.created != null && !this.created.isEmpty();
508    }
509
510    /**
511     * @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
512     */
513    public EnrollmentResponse setCreatedElement(DateTimeType value) { 
514      this.created = value;
515      return this;
516    }
517
518    /**
519     * @return The date when the enclosed suite of services were performed or completed.
520     */
521    public Date getCreated() { 
522      return this.created == null ? null : this.created.getValue();
523    }
524
525    /**
526     * @param value The date when the enclosed suite of services were performed or completed.
527     */
528    public EnrollmentResponse setCreated(Date value) { 
529      if (value == null)
530        this.created = null;
531      else {
532        if (this.created == null)
533          this.created = new DateTimeType();
534        this.created.setValue(value);
535      }
536      return this;
537    }
538
539    /**
540     * @return {@link #organization} (The Insurer who produced this adjudicated response.)
541     */
542    public Reference getOrganization() { 
543      if (this.organization == null)
544        if (Configuration.errorOnAutoCreate())
545          throw new Error("Attempt to auto-create EnrollmentResponse.organization");
546        else if (Configuration.doAutoCreate())
547          this.organization = new Reference(); // cc
548      return this.organization;
549    }
550
551    public boolean hasOrganization() { 
552      return this.organization != null && !this.organization.isEmpty();
553    }
554
555    /**
556     * @param value {@link #organization} (The Insurer who produced this adjudicated response.)
557     */
558    public EnrollmentResponse setOrganization(Reference value) { 
559      this.organization = value;
560      return this;
561    }
562
563    /**
564     * @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
565     */
566    public Reference getRequestProvider() { 
567      if (this.requestProvider == null)
568        if (Configuration.errorOnAutoCreate())
569          throw new Error("Attempt to auto-create EnrollmentResponse.requestProvider");
570        else if (Configuration.doAutoCreate())
571          this.requestProvider = new Reference(); // cc
572      return this.requestProvider;
573    }
574
575    public boolean hasRequestProvider() { 
576      return this.requestProvider != null && !this.requestProvider.isEmpty();
577    }
578
579    /**
580     * @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
581     */
582    public EnrollmentResponse setRequestProvider(Reference value) { 
583      this.requestProvider = value;
584      return this;
585    }
586
587      protected void listChildren(List<Property> children) {
588        super.listChildren(children);
589        children.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
590        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
591        children.add(new Property("request", "Reference(EnrollmentRequest)", "Original request resource reference.", 0, 1, request));
592        children.add(new Property("outcome", "code", "Processing status: error, complete.", 0, 1, outcome));
593        children.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition));
594        children.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created));
595        children.add(new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, 1, organization));
596        children.add(new Property("requestProvider", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider));
597      }
598
599      @Override
600      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
601        switch (_hash) {
602        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
603        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
604        case 1095692943: /*request*/  return new Property("request", "Reference(EnrollmentRequest)", "Original request resource reference.", 0, 1, request);
605        case -1106507950: /*outcome*/  return new Property("outcome", "code", "Processing status: error, complete.", 0, 1, outcome);
606        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition);
607        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created);
608        case 1178922291: /*organization*/  return new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, 1, organization);
609        case 1601527200: /*requestProvider*/  return new Property("requestProvider", "Reference(Practitioner|PractitionerRole|Organization)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider);
610        default: return super.getNamedProperty(_hash, _name, _checkValid);
611        }
612
613      }
614
615      @Override
616      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
617        switch (hash) {
618        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
619        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EnrollmentResponseStatus>
620        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
621        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // Enumeration<RemittanceOutcome>
622        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
623        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
624        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
625        case 1601527200: /*requestProvider*/ return this.requestProvider == null ? new Base[0] : new Base[] {this.requestProvider}; // Reference
626        default: return super.getProperty(hash, name, checkValid);
627        }
628
629      }
630
631      @Override
632      public Base setProperty(int hash, String name, Base value) throws FHIRException {
633        switch (hash) {
634        case -1618432855: // identifier
635          this.getIdentifier().add(castToIdentifier(value)); // Identifier
636          return value;
637        case -892481550: // status
638          value = new EnrollmentResponseStatusEnumFactory().fromType(castToCode(value));
639          this.status = (Enumeration) value; // Enumeration<EnrollmentResponseStatus>
640          return value;
641        case 1095692943: // request
642          this.request = castToReference(value); // Reference
643          return value;
644        case -1106507950: // outcome
645          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
646          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
647          return value;
648        case 583380919: // disposition
649          this.disposition = castToString(value); // StringType
650          return value;
651        case 1028554472: // created
652          this.created = castToDateTime(value); // DateTimeType
653          return value;
654        case 1178922291: // organization
655          this.organization = castToReference(value); // Reference
656          return value;
657        case 1601527200: // requestProvider
658          this.requestProvider = castToReference(value); // Reference
659          return value;
660        default: return super.setProperty(hash, name, value);
661        }
662
663      }
664
665      @Override
666      public Base setProperty(String name, Base value) throws FHIRException {
667        if (name.equals("identifier")) {
668          this.getIdentifier().add(castToIdentifier(value));
669        } else if (name.equals("status")) {
670          value = new EnrollmentResponseStatusEnumFactory().fromType(castToCode(value));
671          this.status = (Enumeration) value; // Enumeration<EnrollmentResponseStatus>
672        } else if (name.equals("request")) {
673          this.request = castToReference(value); // Reference
674        } else if (name.equals("outcome")) {
675          value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
676          this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
677        } else if (name.equals("disposition")) {
678          this.disposition = castToString(value); // StringType
679        } else if (name.equals("created")) {
680          this.created = castToDateTime(value); // DateTimeType
681        } else if (name.equals("organization")) {
682          this.organization = castToReference(value); // Reference
683        } else if (name.equals("requestProvider")) {
684          this.requestProvider = castToReference(value); // Reference
685        } else
686          return super.setProperty(name, value);
687        return value;
688      }
689
690      @Override
691      public Base makeProperty(int hash, String name) throws FHIRException {
692        switch (hash) {
693        case -1618432855:  return addIdentifier(); 
694        case -892481550:  return getStatusElement();
695        case 1095692943:  return getRequest();
696        case -1106507950:  return getOutcomeElement();
697        case 583380919:  return getDispositionElement();
698        case 1028554472:  return getCreatedElement();
699        case 1178922291:  return getOrganization();
700        case 1601527200:  return getRequestProvider();
701        default: return super.makeProperty(hash, name);
702        }
703
704      }
705
706      @Override
707      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
708        switch (hash) {
709        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
710        case -892481550: /*status*/ return new String[] {"code"};
711        case 1095692943: /*request*/ return new String[] {"Reference"};
712        case -1106507950: /*outcome*/ return new String[] {"code"};
713        case 583380919: /*disposition*/ return new String[] {"string"};
714        case 1028554472: /*created*/ return new String[] {"dateTime"};
715        case 1178922291: /*organization*/ return new String[] {"Reference"};
716        case 1601527200: /*requestProvider*/ return new String[] {"Reference"};
717        default: return super.getTypesForProperty(hash, name);
718        }
719
720      }
721
722      @Override
723      public Base addChild(String name) throws FHIRException {
724        if (name.equals("identifier")) {
725          return addIdentifier();
726        }
727        else if (name.equals("status")) {
728          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.status");
729        }
730        else if (name.equals("request")) {
731          this.request = new Reference();
732          return this.request;
733        }
734        else if (name.equals("outcome")) {
735          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.outcome");
736        }
737        else if (name.equals("disposition")) {
738          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.disposition");
739        }
740        else if (name.equals("created")) {
741          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.created");
742        }
743        else if (name.equals("organization")) {
744          this.organization = new Reference();
745          return this.organization;
746        }
747        else if (name.equals("requestProvider")) {
748          this.requestProvider = new Reference();
749          return this.requestProvider;
750        }
751        else
752          return super.addChild(name);
753      }
754
755  public String fhirType() {
756    return "EnrollmentResponse";
757
758  }
759
760      public EnrollmentResponse copy() {
761        EnrollmentResponse dst = new EnrollmentResponse();
762        copyValues(dst);
763        return dst;
764      }
765
766      public void copyValues(EnrollmentResponse dst) {
767        super.copyValues(dst);
768        if (identifier != null) {
769          dst.identifier = new ArrayList<Identifier>();
770          for (Identifier i : identifier)
771            dst.identifier.add(i.copy());
772        };
773        dst.status = status == null ? null : status.copy();
774        dst.request = request == null ? null : request.copy();
775        dst.outcome = outcome == null ? null : outcome.copy();
776        dst.disposition = disposition == null ? null : disposition.copy();
777        dst.created = created == null ? null : created.copy();
778        dst.organization = organization == null ? null : organization.copy();
779        dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
780      }
781
782      protected EnrollmentResponse typedCopy() {
783        return copy();
784      }
785
786      @Override
787      public boolean equalsDeep(Base other_) {
788        if (!super.equalsDeep(other_))
789          return false;
790        if (!(other_ instanceof EnrollmentResponse))
791          return false;
792        EnrollmentResponse o = (EnrollmentResponse) other_;
793        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(request, o.request, true)
794           && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true) && compareDeep(created, o.created, true)
795           && compareDeep(organization, o.organization, true) && compareDeep(requestProvider, o.requestProvider, true)
796          ;
797      }
798
799      @Override
800      public boolean equalsShallow(Base other_) {
801        if (!super.equalsShallow(other_))
802          return false;
803        if (!(other_ instanceof EnrollmentResponse))
804          return false;
805        EnrollmentResponse o = (EnrollmentResponse) other_;
806        return compareValues(status, o.status, true) && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true)
807           && compareValues(created, o.created, true);
808      }
809
810      public boolean isEmpty() {
811        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, request
812          , outcome, disposition, created, organization, requestProvider);
813      }
814
815  @Override
816  public ResourceType getResourceType() {
817    return ResourceType.EnrollmentResponse;
818   }
819
820 /**
821   * Search parameter: <b>identifier</b>
822   * <p>
823   * Description: <b>The business identifier of the EnrollmentResponse</b><br>
824   * Type: <b>token</b><br>
825   * Path: <b>EnrollmentResponse.identifier</b><br>
826   * </p>
827   */
828  @SearchParamDefinition(name="identifier", path="EnrollmentResponse.identifier", description="The business identifier of the EnrollmentResponse", type="token" )
829  public static final String SP_IDENTIFIER = "identifier";
830 /**
831   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
832   * <p>
833   * Description: <b>The business identifier of the EnrollmentResponse</b><br>
834   * Type: <b>token</b><br>
835   * Path: <b>EnrollmentResponse.identifier</b><br>
836   * </p>
837   */
838  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
839
840 /**
841   * Search parameter: <b>request</b>
842   * <p>
843   * Description: <b>The reference to the claim</b><br>
844   * Type: <b>reference</b><br>
845   * Path: <b>EnrollmentResponse.request</b><br>
846   * </p>
847   */
848  @SearchParamDefinition(name="request", path="EnrollmentResponse.request", description="The reference to the claim", type="reference", target={EnrollmentRequest.class } )
849  public static final String SP_REQUEST = "request";
850 /**
851   * <b>Fluent Client</b> search parameter constant for <b>request</b>
852   * <p>
853   * Description: <b>The reference to the claim</b><br>
854   * Type: <b>reference</b><br>
855   * Path: <b>EnrollmentResponse.request</b><br>
856   * </p>
857   */
858  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
859
860/**
861   * Constant for fluent queries to be used to add include statements. Specifies
862   * the path value of "<b>EnrollmentResponse:request</b>".
863   */
864  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("EnrollmentResponse:request").toLocked();
865
866 /**
867   * Search parameter: <b>status</b>
868   * <p>
869   * Description: <b>The status of the enrollment response</b><br>
870   * Type: <b>token</b><br>
871   * Path: <b>EnrollmentResponse.status</b><br>
872   * </p>
873   */
874  @SearchParamDefinition(name="status", path="EnrollmentResponse.status", description="The status of the enrollment response", type="token" )
875  public static final String SP_STATUS = "status";
876 /**
877   * <b>Fluent Client</b> search parameter constant for <b>status</b>
878   * <p>
879   * Description: <b>The status of the enrollment response</b><br>
880   * Type: <b>token</b><br>
881   * Path: <b>EnrollmentResponse.status</b><br>
882   * </p>
883   */
884  public static final ca.uhn.fhir.rest.gclient.TokenClientParam STATUS = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_STATUS);
885
886
887}
888