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