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