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