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