001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Fri, Mar 16, 2018 15:21+1100 for FHIR v3.0.1
033
034import java.util.*;
035
036import org.hl7.fhir.utilities.Utilities;
037import org.hl7.fhir.dstu3.model.Enumerations.*;
038import ca.uhn.fhir.model.api.annotation.ResourceDef;
039import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
040import ca.uhn.fhir.model.api.annotation.Child;
041import ca.uhn.fhir.model.api.annotation.ChildOrder;
042import ca.uhn.fhir.model.api.annotation.Description;
043import ca.uhn.fhir.model.api.annotation.Block;
044import org.hl7.fhir.instance.model.api.*;
045import org.hl7.fhir.exceptions.FHIRException;
046import org.hl7.fhir.exceptions.FHIRFormatError;
047/**
048 * This resource provides enrollment and plan details from the processing of an Enrollment resource.
049 */
050@ResourceDef(name="EnrollmentResponse", profile="http://hl7.org/fhir/StructureDefinition/EnrollmentResponse")
051public class EnrollmentResponse extends DomainResource {
052
053    public enum EnrollmentResponseStatus {
054        /**
055         * The instance is currently in-force.
056         */
057        ACTIVE, 
058        /**
059         * The instance is withdrawn, rescinded or reversed.
060         */
061        CANCELLED, 
062        /**
063         * A new instance the contents of which is not complete.
064         */
065        DRAFT, 
066        /**
067         * The instance was entered in error.
068         */
069        ENTEREDINERROR, 
070        /**
071         * added to help the parsers with the generic types
072         */
073        NULL;
074        public static EnrollmentResponseStatus fromCode(String codeString) throws FHIRException {
075            if (codeString == null || "".equals(codeString))
076                return null;
077        if ("active".equals(codeString))
078          return ACTIVE;
079        if ("cancelled".equals(codeString))
080          return CANCELLED;
081        if ("draft".equals(codeString))
082          return DRAFT;
083        if ("entered-in-error".equals(codeString))
084          return ENTEREDINERROR;
085        if (Configuration.isAcceptInvalidEnums())
086          return null;
087        else
088          throw new FHIRException("Unknown EnrollmentResponseStatus code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case ACTIVE: return "active";
093            case CANCELLED: return "cancelled";
094            case DRAFT: return "draft";
095            case ENTEREDINERROR: return "entered-in-error";
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case ACTIVE: return "http://hl7.org/fhir/fm-status";
102            case CANCELLED: return "http://hl7.org/fhir/fm-status";
103            case DRAFT: return "http://hl7.org/fhir/fm-status";
104            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case ACTIVE: return "The instance is currently in-force.";
111            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
112            case DRAFT: return "A new instance the contents of which is not complete.";
113            case ENTEREDINERROR: return "The instance was entered in error.";
114            default: return "?";
115          }
116        }
117        public String getDisplay() {
118          switch (this) {
119            case ACTIVE: return "Active";
120            case CANCELLED: return "Cancelled";
121            case DRAFT: return "Draft";
122            case ENTEREDINERROR: return "Entered in Error";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class EnrollmentResponseStatusEnumFactory implements EnumFactory<EnrollmentResponseStatus> {
129    public EnrollmentResponseStatus fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("active".equals(codeString))
134          return EnrollmentResponseStatus.ACTIVE;
135        if ("cancelled".equals(codeString))
136          return EnrollmentResponseStatus.CANCELLED;
137        if ("draft".equals(codeString))
138          return EnrollmentResponseStatus.DRAFT;
139        if ("entered-in-error".equals(codeString))
140          return EnrollmentResponseStatus.ENTEREDINERROR;
141        throw new IllegalArgumentException("Unknown EnrollmentResponseStatus code '"+codeString+"'");
142        }
143        public Enumeration<EnrollmentResponseStatus> fromType(Base code) throws FHIRException {
144          if (code == null)
145            return null;
146          if (code.isEmpty())
147            return new Enumeration<EnrollmentResponseStatus>(this);
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("active".equals(codeString))
152          return new Enumeration<EnrollmentResponseStatus>(this, EnrollmentResponseStatus.ACTIVE);
153        if ("cancelled".equals(codeString))
154          return new Enumeration<EnrollmentResponseStatus>(this, EnrollmentResponseStatus.CANCELLED);
155        if ("draft".equals(codeString))
156          return new Enumeration<EnrollmentResponseStatus>(this, EnrollmentResponseStatus.DRAFT);
157        if ("entered-in-error".equals(codeString))
158          return new Enumeration<EnrollmentResponseStatus>(this, EnrollmentResponseStatus.ENTEREDINERROR);
159        throw new FHIRException("Unknown EnrollmentResponseStatus code '"+codeString+"'");
160        }
161    public String toCode(EnrollmentResponseStatus code) {
162      if (code == EnrollmentResponseStatus.ACTIVE)
163        return "active";
164      if (code == EnrollmentResponseStatus.CANCELLED)
165        return "cancelled";
166      if (code == EnrollmentResponseStatus.DRAFT)
167        return "draft";
168      if (code == EnrollmentResponseStatus.ENTEREDINERROR)
169        return "entered-in-error";
170      return "?";
171      }
172    public String toSystem(EnrollmentResponseStatus code) {
173      return code.getSystem();
174      }
175    }
176
177    /**
178     * The Response business identifier.
179     */
180    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
181    @Description(shortDefinition="Business Identifier", formalDefinition="The Response business identifier." )
182    protected List<Identifier> identifier;
183
184    /**
185     * The status of the resource instance.
186     */
187    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
188    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
189    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
190    protected Enumeration<EnrollmentResponseStatus> status;
191
192    /**
193     * Original request resource reference.
194     */
195    @Child(name = "request", type = {EnrollmentRequest.class}, order=2, min=0, max=1, modifier=false, summary=false)
196    @Description(shortDefinition="Claim reference", formalDefinition="Original request resource reference." )
197    protected Reference request;
198
199    /**
200     * The actual object that is the target of the reference (Original request resource reference.)
201     */
202    protected EnrollmentRequest requestTarget;
203
204    /**
205     * Processing status: error, complete.
206     */
207    @Child(name = "outcome", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
208    @Description(shortDefinition="complete | error | partial", formalDefinition="Processing status: error, complete." )
209    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
210    protected CodeableConcept outcome;
211
212    /**
213     * A description of the status of the adjudication.
214     */
215    @Child(name = "disposition", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
216    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
217    protected StringType disposition;
218
219    /**
220     * The date when the enclosed suite of services were performed or completed.
221     */
222    @Child(name = "created", type = {DateTimeType.class}, order=5, min=0, max=1, modifier=false, summary=false)
223    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
224    protected DateTimeType created;
225
226    /**
227     * The Insurer who produced this adjudicated response.
228     */
229    @Child(name = "organization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=false)
230    @Description(shortDefinition="Insurer", formalDefinition="The Insurer who produced this adjudicated response." )
231    protected Reference organization;
232
233    /**
234     * The actual object that is the target of the reference (The Insurer who produced this adjudicated response.)
235     */
236    protected Organization organizationTarget;
237
238    /**
239     * The practitioner who is responsible for the services rendered to the patient.
240     */
241    @Child(name = "requestProvider", type = {Practitioner.class}, order=7, min=0, max=1, modifier=false, summary=false)
242    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
243    protected Reference requestProvider;
244
245    /**
246     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
247     */
248    protected Practitioner requestProviderTarget;
249
250    /**
251     * The organization which is responsible for the services rendered to the patient.
252     */
253    @Child(name = "requestOrganization", type = {Organization.class}, order=8, min=0, max=1, modifier=false, summary=false)
254    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
255    protected Reference requestOrganization;
256
257    /**
258     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
259     */
260    protected Organization requestOrganizationTarget;
261
262    private static final long serialVersionUID = -386781115L;
263
264  /**
265   * Constructor
266   */
267    public EnrollmentResponse() {
268      super();
269    }
270
271    /**
272     * @return {@link #identifier} (The Response business identifier.)
273     */
274    public List<Identifier> getIdentifier() { 
275      if (this.identifier == null)
276        this.identifier = new ArrayList<Identifier>();
277      return this.identifier;
278    }
279
280    /**
281     * @return Returns a reference to <code>this</code> for easy method chaining
282     */
283    public EnrollmentResponse setIdentifier(List<Identifier> theIdentifier) { 
284      this.identifier = theIdentifier;
285      return this;
286    }
287
288    public boolean hasIdentifier() { 
289      if (this.identifier == null)
290        return false;
291      for (Identifier item : this.identifier)
292        if (!item.isEmpty())
293          return true;
294      return false;
295    }
296
297    public Identifier addIdentifier() { //3
298      Identifier t = new Identifier();
299      if (this.identifier == null)
300        this.identifier = new ArrayList<Identifier>();
301      this.identifier.add(t);
302      return t;
303    }
304
305    public EnrollmentResponse addIdentifier(Identifier t) { //3
306      if (t == null)
307        return this;
308      if (this.identifier == null)
309        this.identifier = new ArrayList<Identifier>();
310      this.identifier.add(t);
311      return this;
312    }
313
314    /**
315     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
316     */
317    public Identifier getIdentifierFirstRep() { 
318      if (getIdentifier().isEmpty()) {
319        addIdentifier();
320      }
321      return getIdentifier().get(0);
322    }
323
324    /**
325     * @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
326     */
327    public Enumeration<EnrollmentResponseStatus> getStatusElement() { 
328      if (this.status == null)
329        if (Configuration.errorOnAutoCreate())
330          throw new Error("Attempt to auto-create EnrollmentResponse.status");
331        else if (Configuration.doAutoCreate())
332          this.status = new Enumeration<EnrollmentResponseStatus>(new EnrollmentResponseStatusEnumFactory()); // bb
333      return this.status;
334    }
335
336    public boolean hasStatusElement() { 
337      return this.status != null && !this.status.isEmpty();
338    }
339
340    public boolean hasStatus() { 
341      return this.status != null && !this.status.isEmpty();
342    }
343
344    /**
345     * @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
346     */
347    public EnrollmentResponse setStatusElement(Enumeration<EnrollmentResponseStatus> value) { 
348      this.status = value;
349      return this;
350    }
351
352    /**
353     * @return The status of the resource instance.
354     */
355    public EnrollmentResponseStatus getStatus() { 
356      return this.status == null ? null : this.status.getValue();
357    }
358
359    /**
360     * @param value The status of the resource instance.
361     */
362    public EnrollmentResponse setStatus(EnrollmentResponseStatus value) { 
363      if (value == null)
364        this.status = null;
365      else {
366        if (this.status == null)
367          this.status = new Enumeration<EnrollmentResponseStatus>(new EnrollmentResponseStatusEnumFactory());
368        this.status.setValue(value);
369      }
370      return this;
371    }
372
373    /**
374     * @return {@link #request} (Original request resource reference.)
375     */
376    public Reference getRequest() { 
377      if (this.request == null)
378        if (Configuration.errorOnAutoCreate())
379          throw new Error("Attempt to auto-create EnrollmentResponse.request");
380        else if (Configuration.doAutoCreate())
381          this.request = new Reference(); // cc
382      return this.request;
383    }
384
385    public boolean hasRequest() { 
386      return this.request != null && !this.request.isEmpty();
387    }
388
389    /**
390     * @param value {@link #request} (Original request resource reference.)
391     */
392    public EnrollmentResponse setRequest(Reference value)  { 
393      this.request = value;
394      return this;
395    }
396
397    /**
398     * @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.)
399     */
400    public EnrollmentRequest getRequestTarget() { 
401      if (this.requestTarget == null)
402        if (Configuration.errorOnAutoCreate())
403          throw new Error("Attempt to auto-create EnrollmentResponse.request");
404        else if (Configuration.doAutoCreate())
405          this.requestTarget = new EnrollmentRequest(); // aa
406      return this.requestTarget;
407    }
408
409    /**
410     * @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.)
411     */
412    public EnrollmentResponse setRequestTarget(EnrollmentRequest value) { 
413      this.requestTarget = value;
414      return this;
415    }
416
417    /**
418     * @return {@link #outcome} (Processing status: error, complete.)
419     */
420    public CodeableConcept getOutcome() { 
421      if (this.outcome == null)
422        if (Configuration.errorOnAutoCreate())
423          throw new Error("Attempt to auto-create EnrollmentResponse.outcome");
424        else if (Configuration.doAutoCreate())
425          this.outcome = new CodeableConcept(); // cc
426      return this.outcome;
427    }
428
429    public boolean hasOutcome() { 
430      return this.outcome != null && !this.outcome.isEmpty();
431    }
432
433    /**
434     * @param value {@link #outcome} (Processing status: error, complete.)
435     */
436    public EnrollmentResponse setOutcome(CodeableConcept value)  { 
437      this.outcome = value;
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 #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.)
565     */
566    public Organization getOrganizationTarget() { 
567      if (this.organizationTarget == null)
568        if (Configuration.errorOnAutoCreate())
569          throw new Error("Attempt to auto-create EnrollmentResponse.organization");
570        else if (Configuration.doAutoCreate())
571          this.organizationTarget = new Organization(); // aa
572      return this.organizationTarget;
573    }
574
575    /**
576     * @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.)
577     */
578    public EnrollmentResponse setOrganizationTarget(Organization value) { 
579      this.organizationTarget = value;
580      return this;
581    }
582
583    /**
584     * @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
585     */
586    public Reference getRequestProvider() { 
587      if (this.requestProvider == null)
588        if (Configuration.errorOnAutoCreate())
589          throw new Error("Attempt to auto-create EnrollmentResponse.requestProvider");
590        else if (Configuration.doAutoCreate())
591          this.requestProvider = new Reference(); // cc
592      return this.requestProvider;
593    }
594
595    public boolean hasRequestProvider() { 
596      return this.requestProvider != null && !this.requestProvider.isEmpty();
597    }
598
599    /**
600     * @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
601     */
602    public EnrollmentResponse setRequestProvider(Reference value)  { 
603      this.requestProvider = value;
604      return this;
605    }
606
607    /**
608     * @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.)
609     */
610    public Practitioner getRequestProviderTarget() { 
611      if (this.requestProviderTarget == null)
612        if (Configuration.errorOnAutoCreate())
613          throw new Error("Attempt to auto-create EnrollmentResponse.requestProvider");
614        else if (Configuration.doAutoCreate())
615          this.requestProviderTarget = new Practitioner(); // aa
616      return this.requestProviderTarget;
617    }
618
619    /**
620     * @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.)
621     */
622    public EnrollmentResponse setRequestProviderTarget(Practitioner value) { 
623      this.requestProviderTarget = value;
624      return this;
625    }
626
627    /**
628     * @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
629     */
630    public Reference getRequestOrganization() { 
631      if (this.requestOrganization == null)
632        if (Configuration.errorOnAutoCreate())
633          throw new Error("Attempt to auto-create EnrollmentResponse.requestOrganization");
634        else if (Configuration.doAutoCreate())
635          this.requestOrganization = new Reference(); // cc
636      return this.requestOrganization;
637    }
638
639    public boolean hasRequestOrganization() { 
640      return this.requestOrganization != null && !this.requestOrganization.isEmpty();
641    }
642
643    /**
644     * @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
645     */
646    public EnrollmentResponse setRequestOrganization(Reference value)  { 
647      this.requestOrganization = value;
648      return this;
649    }
650
651    /**
652     * @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.)
653     */
654    public Organization getRequestOrganizationTarget() { 
655      if (this.requestOrganizationTarget == null)
656        if (Configuration.errorOnAutoCreate())
657          throw new Error("Attempt to auto-create EnrollmentResponse.requestOrganization");
658        else if (Configuration.doAutoCreate())
659          this.requestOrganizationTarget = new Organization(); // aa
660      return this.requestOrganizationTarget;
661    }
662
663    /**
664     * @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.)
665     */
666    public EnrollmentResponse setRequestOrganizationTarget(Organization value) { 
667      this.requestOrganizationTarget = value;
668      return this;
669    }
670
671      protected void listChildren(List<Property> children) {
672        super.listChildren(children);
673        children.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
674        children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
675        children.add(new Property("request", "Reference(EnrollmentRequest)", "Original request resource reference.", 0, 1, request));
676        children.add(new Property("outcome", "CodeableConcept", "Processing status: error, complete.", 0, 1, outcome));
677        children.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition));
678        children.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created));
679        children.add(new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, 1, organization));
680        children.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider));
681        children.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, requestOrganization));
682      }
683
684      @Override
685      public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
686        switch (_hash) {
687        case -1618432855: /*identifier*/  return new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier);
688        case -892481550: /*status*/  return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
689        case 1095692943: /*request*/  return new Property("request", "Reference(EnrollmentRequest)", "Original request resource reference.", 0, 1, request);
690        case -1106507950: /*outcome*/  return new Property("outcome", "CodeableConcept", "Processing status: error, complete.", 0, 1, outcome);
691        case 583380919: /*disposition*/  return new Property("disposition", "string", "A description of the status of the adjudication.", 0, 1, disposition);
692        case 1028554472: /*created*/  return new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, 1, created);
693        case 1178922291: /*organization*/  return new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, 1, organization);
694        case 1601527200: /*requestProvider*/  return new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, 1, requestProvider);
695        case 599053666: /*requestOrganization*/  return new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, 1, requestOrganization);
696        default: return super.getNamedProperty(_hash, _name, _checkValid);
697        }
698
699      }
700
701      @Override
702      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
703        switch (hash) {
704        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
705        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<EnrollmentResponseStatus>
706        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
707        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
708        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
709        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
710        case 1178922291: /*organization*/ return this.organization == null ? new Base[0] : new Base[] {this.organization}; // Reference
711        case 1601527200: /*requestProvider*/ return this.requestProvider == null ? new Base[0] : new Base[] {this.requestProvider}; // Reference
712        case 599053666: /*requestOrganization*/ return this.requestOrganization == null ? new Base[0] : new Base[] {this.requestOrganization}; // Reference
713        default: return super.getProperty(hash, name, checkValid);
714        }
715
716      }
717
718      @Override
719      public Base setProperty(int hash, String name, Base value) throws FHIRException {
720        switch (hash) {
721        case -1618432855: // identifier
722          this.getIdentifier().add(castToIdentifier(value)); // Identifier
723          return value;
724        case -892481550: // status
725          value = new EnrollmentResponseStatusEnumFactory().fromType(castToCode(value));
726          this.status = (Enumeration) value; // Enumeration<EnrollmentResponseStatus>
727          return value;
728        case 1095692943: // request
729          this.request = castToReference(value); // Reference
730          return value;
731        case -1106507950: // outcome
732          this.outcome = castToCodeableConcept(value); // CodeableConcept
733          return value;
734        case 583380919: // disposition
735          this.disposition = castToString(value); // StringType
736          return value;
737        case 1028554472: // created
738          this.created = castToDateTime(value); // DateTimeType
739          return value;
740        case 1178922291: // organization
741          this.organization = castToReference(value); // Reference
742          return value;
743        case 1601527200: // requestProvider
744          this.requestProvider = castToReference(value); // Reference
745          return value;
746        case 599053666: // requestOrganization
747          this.requestOrganization = castToReference(value); // Reference
748          return value;
749        default: return super.setProperty(hash, name, value);
750        }
751
752      }
753
754      @Override
755      public Base setProperty(String name, Base value) throws FHIRException {
756        if (name.equals("identifier")) {
757          this.getIdentifier().add(castToIdentifier(value));
758        } else if (name.equals("status")) {
759          value = new EnrollmentResponseStatusEnumFactory().fromType(castToCode(value));
760          this.status = (Enumeration) value; // Enumeration<EnrollmentResponseStatus>
761        } else if (name.equals("request")) {
762          this.request = castToReference(value); // Reference
763        } else if (name.equals("outcome")) {
764          this.outcome = castToCodeableConcept(value); // CodeableConcept
765        } else if (name.equals("disposition")) {
766          this.disposition = castToString(value); // StringType
767        } else if (name.equals("created")) {
768          this.created = castToDateTime(value); // DateTimeType
769        } else if (name.equals("organization")) {
770          this.organization = castToReference(value); // Reference
771        } else if (name.equals("requestProvider")) {
772          this.requestProvider = castToReference(value); // Reference
773        } else if (name.equals("requestOrganization")) {
774          this.requestOrganization = castToReference(value); // Reference
775        } else
776          return super.setProperty(name, value);
777        return value;
778      }
779
780      @Override
781      public Base makeProperty(int hash, String name) throws FHIRException {
782        switch (hash) {
783        case -1618432855:  return addIdentifier(); 
784        case -892481550:  return getStatusElement();
785        case 1095692943:  return getRequest(); 
786        case -1106507950:  return getOutcome(); 
787        case 583380919:  return getDispositionElement();
788        case 1028554472:  return getCreatedElement();
789        case 1178922291:  return getOrganization(); 
790        case 1601527200:  return getRequestProvider(); 
791        case 599053666:  return getRequestOrganization(); 
792        default: return super.makeProperty(hash, name);
793        }
794
795      }
796
797      @Override
798      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
799        switch (hash) {
800        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
801        case -892481550: /*status*/ return new String[] {"code"};
802        case 1095692943: /*request*/ return new String[] {"Reference"};
803        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
804        case 583380919: /*disposition*/ return new String[] {"string"};
805        case 1028554472: /*created*/ return new String[] {"dateTime"};
806        case 1178922291: /*organization*/ return new String[] {"Reference"};
807        case 1601527200: /*requestProvider*/ return new String[] {"Reference"};
808        case 599053666: /*requestOrganization*/ return new String[] {"Reference"};
809        default: return super.getTypesForProperty(hash, name);
810        }
811
812      }
813
814      @Override
815      public Base addChild(String name) throws FHIRException {
816        if (name.equals("identifier")) {
817          return addIdentifier();
818        }
819        else if (name.equals("status")) {
820          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.status");
821        }
822        else if (name.equals("request")) {
823          this.request = new Reference();
824          return this.request;
825        }
826        else if (name.equals("outcome")) {
827          this.outcome = new CodeableConcept();
828          return this.outcome;
829        }
830        else if (name.equals("disposition")) {
831          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.disposition");
832        }
833        else if (name.equals("created")) {
834          throw new FHIRException("Cannot call addChild on a primitive type EnrollmentResponse.created");
835        }
836        else if (name.equals("organization")) {
837          this.organization = new Reference();
838          return this.organization;
839        }
840        else if (name.equals("requestProvider")) {
841          this.requestProvider = new Reference();
842          return this.requestProvider;
843        }
844        else if (name.equals("requestOrganization")) {
845          this.requestOrganization = new Reference();
846          return this.requestOrganization;
847        }
848        else
849          return super.addChild(name);
850      }
851
852  public String fhirType() {
853    return "EnrollmentResponse";
854
855  }
856
857      public EnrollmentResponse copy() {
858        EnrollmentResponse dst = new EnrollmentResponse();
859        copyValues(dst);
860        if (identifier != null) {
861          dst.identifier = new ArrayList<Identifier>();
862          for (Identifier i : identifier)
863            dst.identifier.add(i.copy());
864        };
865        dst.status = status == null ? null : status.copy();
866        dst.request = request == null ? null : request.copy();
867        dst.outcome = outcome == null ? null : outcome.copy();
868        dst.disposition = disposition == null ? null : disposition.copy();
869        dst.created = created == null ? null : created.copy();
870        dst.organization = organization == null ? null : organization.copy();
871        dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
872        dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
873        return dst;
874      }
875
876      protected EnrollmentResponse typedCopy() {
877        return copy();
878      }
879
880      @Override
881      public boolean equalsDeep(Base other_) {
882        if (!super.equalsDeep(other_))
883          return false;
884        if (!(other_ instanceof EnrollmentResponse))
885          return false;
886        EnrollmentResponse o = (EnrollmentResponse) other_;
887        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(request, o.request, true)
888           && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true) && compareDeep(created, o.created, true)
889           && compareDeep(organization, o.organization, true) && compareDeep(requestProvider, o.requestProvider, true)
890           && compareDeep(requestOrganization, o.requestOrganization, true);
891      }
892
893      @Override
894      public boolean equalsShallow(Base other_) {
895        if (!super.equalsShallow(other_))
896          return false;
897        if (!(other_ instanceof EnrollmentResponse))
898          return false;
899        EnrollmentResponse o = (EnrollmentResponse) other_;
900        return compareValues(status, o.status, true) && compareValues(disposition, o.disposition, true) && compareValues(created, o.created, true)
901          ;
902      }
903
904      public boolean isEmpty() {
905        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, request
906          , outcome, disposition, created, organization, requestProvider, requestOrganization
907          );
908      }
909
910  @Override
911  public ResourceType getResourceType() {
912    return ResourceType.EnrollmentResponse;
913   }
914
915 /**
916   * Search parameter: <b>identifier</b>
917   * <p>
918   * Description: <b>The business identifier of the EnrollmentResponse</b><br>
919   * Type: <b>token</b><br>
920   * Path: <b>EnrollmentResponse.identifier</b><br>
921   * </p>
922   */
923  @SearchParamDefinition(name="identifier", path="EnrollmentResponse.identifier", description="The business identifier of the EnrollmentResponse", type="token" )
924  public static final String SP_IDENTIFIER = "identifier";
925 /**
926   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
927   * <p>
928   * Description: <b>The business identifier of the EnrollmentResponse</b><br>
929   * Type: <b>token</b><br>
930   * Path: <b>EnrollmentResponse.identifier</b><br>
931   * </p>
932   */
933  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
934
935 /**
936   * Search parameter: <b>request</b>
937   * <p>
938   * Description: <b>The reference to the claim</b><br>
939   * Type: <b>reference</b><br>
940   * Path: <b>EnrollmentResponse.request</b><br>
941   * </p>
942   */
943  @SearchParamDefinition(name="request", path="EnrollmentResponse.request", description="The reference to the claim", type="reference", target={EnrollmentRequest.class } )
944  public static final String SP_REQUEST = "request";
945 /**
946   * <b>Fluent Client</b> search parameter constant for <b>request</b>
947   * <p>
948   * Description: <b>The reference to the claim</b><br>
949   * Type: <b>reference</b><br>
950   * Path: <b>EnrollmentResponse.request</b><br>
951   * </p>
952   */
953  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
954
955/**
956   * Constant for fluent queries to be used to add include statements. Specifies
957   * the path value of "<b>EnrollmentResponse:request</b>".
958   */
959  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("EnrollmentResponse:request").toLocked();
960
961 /**
962   * Search parameter: <b>organization</b>
963   * <p>
964   * Description: <b>The organization who generated this resource</b><br>
965   * Type: <b>reference</b><br>
966   * Path: <b>EnrollmentResponse.organization</b><br>
967   * </p>
968   */
969  @SearchParamDefinition(name="organization", path="EnrollmentResponse.organization", description="The organization who generated this resource", type="reference", target={Organization.class } )
970  public static final String SP_ORGANIZATION = "organization";
971 /**
972   * <b>Fluent Client</b> search parameter constant for <b>organization</b>
973   * <p>
974   * Description: <b>The organization who generated this resource</b><br>
975   * Type: <b>reference</b><br>
976   * Path: <b>EnrollmentResponse.organization</b><br>
977   * </p>
978   */
979  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ORGANIZATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ORGANIZATION);
980
981/**
982   * Constant for fluent queries to be used to add include statements. Specifies
983   * the path value of "<b>EnrollmentResponse:organization</b>".
984   */
985  public static final ca.uhn.fhir.model.api.Include INCLUDE_ORGANIZATION = new ca.uhn.fhir.model.api.Include("EnrollmentResponse:organization").toLocked();
986
987
988}
989