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