001package org.hl7.fhir.r4.model;
002
003import java.math.BigDecimal;
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 Tue, May 12, 2020 07:26+1000 for FHIR v4.0.1
035import java.util.ArrayList;
036import java.util.Date;
037import java.util.List;
038
039import org.hl7.fhir.exceptions.FHIRException;
040import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
041import org.hl7.fhir.r4.model.Enumerations.NoteType;
042import org.hl7.fhir.r4.model.Enumerations.NoteTypeEnumFactory;
043import org.hl7.fhir.utilities.Utilities;
044
045import ca.uhn.fhir.model.api.annotation.Block;
046import ca.uhn.fhir.model.api.annotation.Child;
047import ca.uhn.fhir.model.api.annotation.Description;
048import ca.uhn.fhir.model.api.annotation.ResourceDef;
049import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
050
051/**
052 * This resource provides the adjudication details from the processing of a
053 * Claim resource.
054 */
055@ResourceDef(name = "ClaimResponse", profile = "http://hl7.org/fhir/StructureDefinition/ClaimResponse")
056public class ClaimResponse extends DomainResource {
057
058  public enum ClaimResponseStatus {
059    /**
060     * The instance is currently in-force.
061     */
062    ACTIVE,
063    /**
064     * The instance is withdrawn, rescinded or reversed.
065     */
066    CANCELLED,
067    /**
068     * A new instance the contents of which is not complete.
069     */
070    DRAFT,
071    /**
072     * The instance was entered in error.
073     */
074    ENTEREDINERROR,
075    /**
076     * added to help the parsers with the generic types
077     */
078    NULL;
079
080    public static ClaimResponseStatus fromCode(String codeString) throws FHIRException {
081      if (codeString == null || "".equals(codeString))
082        return null;
083      if ("active".equals(codeString))
084        return ACTIVE;
085      if ("cancelled".equals(codeString))
086        return CANCELLED;
087      if ("draft".equals(codeString))
088        return DRAFT;
089      if ("entered-in-error".equals(codeString))
090        return ENTEREDINERROR;
091      if (Configuration.isAcceptInvalidEnums())
092        return null;
093      else
094        throw new FHIRException("Unknown ClaimResponseStatus code '" + codeString + "'");
095    }
096
097    public String toCode() {
098      switch (this) {
099      case ACTIVE:
100        return "active";
101      case CANCELLED:
102        return "cancelled";
103      case DRAFT:
104        return "draft";
105      case ENTEREDINERROR:
106        return "entered-in-error";
107      case NULL:
108        return null;
109      default:
110        return "?";
111      }
112    }
113
114    public String getSystem() {
115      switch (this) {
116      case ACTIVE:
117        return "http://hl7.org/fhir/fm-status";
118      case CANCELLED:
119        return "http://hl7.org/fhir/fm-status";
120      case DRAFT:
121        return "http://hl7.org/fhir/fm-status";
122      case ENTEREDINERROR:
123        return "http://hl7.org/fhir/fm-status";
124      case NULL:
125        return null;
126      default:
127        return "?";
128      }
129    }
130
131    public String getDefinition() {
132      switch (this) {
133      case ACTIVE:
134        return "The instance is currently in-force.";
135      case CANCELLED:
136        return "The instance is withdrawn, rescinded or reversed.";
137      case DRAFT:
138        return "A new instance the contents of which is not complete.";
139      case ENTEREDINERROR:
140        return "The instance was entered in error.";
141      case NULL:
142        return null;
143      default:
144        return "?";
145      }
146    }
147
148    public String getDisplay() {
149      switch (this) {
150      case ACTIVE:
151        return "Active";
152      case CANCELLED:
153        return "Cancelled";
154      case DRAFT:
155        return "Draft";
156      case ENTEREDINERROR:
157        return "Entered in Error";
158      case NULL:
159        return null;
160      default:
161        return "?";
162      }
163    }
164  }
165
166  public static class ClaimResponseStatusEnumFactory implements EnumFactory<ClaimResponseStatus> {
167    public ClaimResponseStatus fromCode(String codeString) throws IllegalArgumentException {
168      if (codeString == null || "".equals(codeString))
169        if (codeString == null || "".equals(codeString))
170          return null;
171      if ("active".equals(codeString))
172        return ClaimResponseStatus.ACTIVE;
173      if ("cancelled".equals(codeString))
174        return ClaimResponseStatus.CANCELLED;
175      if ("draft".equals(codeString))
176        return ClaimResponseStatus.DRAFT;
177      if ("entered-in-error".equals(codeString))
178        return ClaimResponseStatus.ENTEREDINERROR;
179      throw new IllegalArgumentException("Unknown ClaimResponseStatus code '" + codeString + "'");
180    }
181
182    public Enumeration<ClaimResponseStatus> fromType(PrimitiveType<?> code) throws FHIRException {
183      if (code == null)
184        return null;
185      if (code.isEmpty())
186        return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.NULL, code);
187      String codeString = code.asStringValue();
188      if (codeString == null || "".equals(codeString))
189        return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.NULL, code);
190      if ("active".equals(codeString))
191        return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.ACTIVE, code);
192      if ("cancelled".equals(codeString))
193        return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.CANCELLED, code);
194      if ("draft".equals(codeString))
195        return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.DRAFT, code);
196      if ("entered-in-error".equals(codeString))
197        return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.ENTEREDINERROR, code);
198      throw new FHIRException("Unknown ClaimResponseStatus code '" + codeString + "'");
199    }
200
201    public String toCode(ClaimResponseStatus code) {
202      if (code == ClaimResponseStatus.ACTIVE)
203        return "active";
204      if (code == ClaimResponseStatus.CANCELLED)
205        return "cancelled";
206      if (code == ClaimResponseStatus.DRAFT)
207        return "draft";
208      if (code == ClaimResponseStatus.ENTEREDINERROR)
209        return "entered-in-error";
210      return "?";
211    }
212
213    public String toSystem(ClaimResponseStatus code) {
214      return code.getSystem();
215    }
216  }
217
218  public enum Use {
219    /**
220     * The treatment is complete and this represents a Claim for the services.
221     */
222    CLAIM,
223    /**
224     * The treatment is proposed and this represents a Pre-authorization for the
225     * services.
226     */
227    PREAUTHORIZATION,
228    /**
229     * The treatment is proposed and this represents a Pre-determination for the
230     * services.
231     */
232    PREDETERMINATION,
233    /**
234     * added to help the parsers with the generic types
235     */
236    NULL;
237
238    public static Use fromCode(String codeString) throws FHIRException {
239      if (codeString == null || "".equals(codeString))
240        return null;
241      if ("claim".equals(codeString))
242        return CLAIM;
243      if ("preauthorization".equals(codeString))
244        return PREAUTHORIZATION;
245      if ("predetermination".equals(codeString))
246        return PREDETERMINATION;
247      if (Configuration.isAcceptInvalidEnums())
248        return null;
249      else
250        throw new FHIRException("Unknown Use code '" + codeString + "'");
251    }
252
253    public String toCode() {
254      switch (this) {
255      case CLAIM:
256        return "claim";
257      case PREAUTHORIZATION:
258        return "preauthorization";
259      case PREDETERMINATION:
260        return "predetermination";
261      case NULL:
262        return null;
263      default:
264        return "?";
265      }
266    }
267
268    public String getSystem() {
269      switch (this) {
270      case CLAIM:
271        return "http://hl7.org/fhir/claim-use";
272      case PREAUTHORIZATION:
273        return "http://hl7.org/fhir/claim-use";
274      case PREDETERMINATION:
275        return "http://hl7.org/fhir/claim-use";
276      case NULL:
277        return null;
278      default:
279        return "?";
280      }
281    }
282
283    public String getDefinition() {
284      switch (this) {
285      case CLAIM:
286        return "The treatment is complete and this represents a Claim for the services.";
287      case PREAUTHORIZATION:
288        return "The treatment is proposed and this represents a Pre-authorization for the services.";
289      case PREDETERMINATION:
290        return "The treatment is proposed and this represents a Pre-determination for the services.";
291      case NULL:
292        return null;
293      default:
294        return "?";
295      }
296    }
297
298    public String getDisplay() {
299      switch (this) {
300      case CLAIM:
301        return "Claim";
302      case PREAUTHORIZATION:
303        return "Preauthorization";
304      case PREDETERMINATION:
305        return "Predetermination";
306      case NULL:
307        return null;
308      default:
309        return "?";
310      }
311    }
312  }
313
314  public static class UseEnumFactory implements EnumFactory<Use> {
315    public Use fromCode(String codeString) throws IllegalArgumentException {
316      if (codeString == null || "".equals(codeString))
317        if (codeString == null || "".equals(codeString))
318          return null;
319      if ("claim".equals(codeString))
320        return Use.CLAIM;
321      if ("preauthorization".equals(codeString))
322        return Use.PREAUTHORIZATION;
323      if ("predetermination".equals(codeString))
324        return Use.PREDETERMINATION;
325      throw new IllegalArgumentException("Unknown Use code '" + codeString + "'");
326    }
327
328    public Enumeration<Use> fromType(PrimitiveType<?> code) throws FHIRException {
329      if (code == null)
330        return null;
331      if (code.isEmpty())
332        return new Enumeration<Use>(this, Use.NULL, code);
333      String codeString = code.asStringValue();
334      if (codeString == null || "".equals(codeString))
335        return new Enumeration<Use>(this, Use.NULL, code);
336      if ("claim".equals(codeString))
337        return new Enumeration<Use>(this, Use.CLAIM, code);
338      if ("preauthorization".equals(codeString))
339        return new Enumeration<Use>(this, Use.PREAUTHORIZATION, code);
340      if ("predetermination".equals(codeString))
341        return new Enumeration<Use>(this, Use.PREDETERMINATION, code);
342      throw new FHIRException("Unknown Use code '" + codeString + "'");
343    }
344
345    public String toCode(Use code) {
346      if (code == Use.CLAIM)
347        return "claim";
348      if (code == Use.PREAUTHORIZATION)
349        return "preauthorization";
350      if (code == Use.PREDETERMINATION)
351        return "predetermination";
352      return "?";
353    }
354
355    public String toSystem(Use code) {
356      return code.getSystem();
357    }
358  }
359
360  public enum RemittanceOutcome {
361    /**
362     * The Claim/Pre-authorization/Pre-determination has been received but
363     * processing has not begun.
364     */
365    QUEUED,
366    /**
367     * The processing has completed without errors
368     */
369    COMPLETE,
370    /**
371     * One or more errors have been detected in the Claim
372     */
373    ERROR,
374    /**
375     * No errors have been detected in the Claim and some of the adjudication has
376     * been performed.
377     */
378    PARTIAL,
379    /**
380     * added to help the parsers with the generic types
381     */
382    NULL;
383
384    public static RemittanceOutcome fromCode(String codeString) throws FHIRException {
385      if (codeString == null || "".equals(codeString))
386        return null;
387      if ("queued".equals(codeString))
388        return QUEUED;
389      if ("complete".equals(codeString))
390        return COMPLETE;
391      if ("error".equals(codeString))
392        return ERROR;
393      if ("partial".equals(codeString))
394        return PARTIAL;
395      if (Configuration.isAcceptInvalidEnums())
396        return null;
397      else
398        throw new FHIRException("Unknown RemittanceOutcome code '" + codeString + "'");
399    }
400
401    public String toCode() {
402      switch (this) {
403      case QUEUED:
404        return "queued";
405      case COMPLETE:
406        return "complete";
407      case ERROR:
408        return "error";
409      case PARTIAL:
410        return "partial";
411      case NULL:
412        return null;
413      default:
414        return "?";
415      }
416    }
417
418    public String getSystem() {
419      switch (this) {
420      case QUEUED:
421        return "http://hl7.org/fhir/remittance-outcome";
422      case COMPLETE:
423        return "http://hl7.org/fhir/remittance-outcome";
424      case ERROR:
425        return "http://hl7.org/fhir/remittance-outcome";
426      case PARTIAL:
427        return "http://hl7.org/fhir/remittance-outcome";
428      case NULL:
429        return null;
430      default:
431        return "?";
432      }
433    }
434
435    public String getDefinition() {
436      switch (this) {
437      case QUEUED:
438        return "The Claim/Pre-authorization/Pre-determination has been received but processing has not begun.";
439      case COMPLETE:
440        return "The processing has completed without errors";
441      case ERROR:
442        return "One or more errors have been detected in the Claim";
443      case PARTIAL:
444        return "No errors have been detected in the Claim and some of the adjudication has been performed.";
445      case NULL:
446        return null;
447      default:
448        return "?";
449      }
450    }
451
452    public String getDisplay() {
453      switch (this) {
454      case QUEUED:
455        return "Queued";
456      case COMPLETE:
457        return "Processing Complete";
458      case ERROR:
459        return "Error";
460      case PARTIAL:
461        return "Partial Processing";
462      case NULL:
463        return null;
464      default:
465        return "?";
466      }
467    }
468  }
469
470  public static class RemittanceOutcomeEnumFactory implements EnumFactory<RemittanceOutcome> {
471    public RemittanceOutcome fromCode(String codeString) throws IllegalArgumentException {
472      if (codeString == null || "".equals(codeString))
473        if (codeString == null || "".equals(codeString))
474          return null;
475      if ("queued".equals(codeString))
476        return RemittanceOutcome.QUEUED;
477      if ("complete".equals(codeString))
478        return RemittanceOutcome.COMPLETE;
479      if ("error".equals(codeString))
480        return RemittanceOutcome.ERROR;
481      if ("partial".equals(codeString))
482        return RemittanceOutcome.PARTIAL;
483      throw new IllegalArgumentException("Unknown RemittanceOutcome code '" + codeString + "'");
484    }
485
486    public Enumeration<RemittanceOutcome> fromType(PrimitiveType<?> code) throws FHIRException {
487      if (code == null)
488        return null;
489      if (code.isEmpty())
490        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.NULL, code);
491      String codeString = code.asStringValue();
492      if (codeString == null || "".equals(codeString))
493        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.NULL, code);
494      if ("queued".equals(codeString))
495        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.QUEUED, code);
496      if ("complete".equals(codeString))
497        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.COMPLETE, code);
498      if ("error".equals(codeString))
499        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.ERROR, code);
500      if ("partial".equals(codeString))
501        return new Enumeration<RemittanceOutcome>(this, RemittanceOutcome.PARTIAL, code);
502      throw new FHIRException("Unknown RemittanceOutcome code '" + codeString + "'");
503    }
504
505    public String toCode(RemittanceOutcome code) {
506      if (code == RemittanceOutcome.QUEUED)
507        return "queued";
508      if (code == RemittanceOutcome.COMPLETE)
509        return "complete";
510      if (code == RemittanceOutcome.ERROR)
511        return "error";
512      if (code == RemittanceOutcome.PARTIAL)
513        return "partial";
514      return "?";
515    }
516
517    public String toSystem(RemittanceOutcome code) {
518      return code.getSystem();
519    }
520  }
521
522  @Block()
523  public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
524    /**
525     * A number to uniquely reference the claim item entries.
526     */
527    @Child(name = "itemSequence", type = {
528        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
529    @Description(shortDefinition = "Claim item instance identifier", formalDefinition = "A number to uniquely reference the claim item entries.")
530    protected PositiveIntType itemSequence;
531
532    /**
533     * The numbers associated with notes below which apply to the adjudication of
534     * this item.
535     */
536    @Child(name = "noteNumber", type = {
537        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
538    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
539    protected List<PositiveIntType> noteNumber;
540
541    /**
542     * If this item is a group then the values here are a summary of the
543     * adjudication of the detail items. If this item is a simple product or service
544     * then this is the result of the adjudication of this item.
545     */
546    @Child(name = "adjudication", type = {}, order = 3, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
547    @Description(shortDefinition = "Adjudication details", formalDefinition = "If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.")
548    protected List<AdjudicationComponent> adjudication;
549
550    /**
551     * A claim detail. Either a simple (a product or service) or a 'group' of
552     * sub-details which are simple items.
553     */
554    @Child(name = "detail", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
555    @Description(shortDefinition = "Adjudication for claim details", formalDefinition = "A claim detail. Either a simple (a product or service) or a 'group' of sub-details which are simple items.")
556    protected List<ItemDetailComponent> detail;
557
558    private static final long serialVersionUID = 701277928L;
559
560    /**
561     * Constructor
562     */
563    public ItemComponent() {
564      super();
565    }
566
567    /**
568     * Constructor
569     */
570    public ItemComponent(PositiveIntType itemSequence) {
571      super();
572      this.itemSequence = itemSequence;
573    }
574
575    /**
576     * @return {@link #itemSequence} (A number to uniquely reference the claim item
577     *         entries.). This is the underlying object with id, value and
578     *         extensions. The accessor "getItemSequence" gives direct access to the
579     *         value
580     */
581    public PositiveIntType getItemSequenceElement() {
582      if (this.itemSequence == null)
583        if (Configuration.errorOnAutoCreate())
584          throw new Error("Attempt to auto-create ItemComponent.itemSequence");
585        else if (Configuration.doAutoCreate())
586          this.itemSequence = new PositiveIntType(); // bb
587      return this.itemSequence;
588    }
589
590    public boolean hasItemSequenceElement() {
591      return this.itemSequence != null && !this.itemSequence.isEmpty();
592    }
593
594    public boolean hasItemSequence() {
595      return this.itemSequence != null && !this.itemSequence.isEmpty();
596    }
597
598    /**
599     * @param value {@link #itemSequence} (A number to uniquely reference the claim
600     *              item entries.). This is the underlying object with id, value and
601     *              extensions. The accessor "getItemSequence" gives direct access
602     *              to the value
603     */
604    public ItemComponent setItemSequenceElement(PositiveIntType value) {
605      this.itemSequence = value;
606      return this;
607    }
608
609    /**
610     * @return A number to uniquely reference the claim item entries.
611     */
612    public int getItemSequence() {
613      return this.itemSequence == null || this.itemSequence.isEmpty() ? 0 : this.itemSequence.getValue();
614    }
615
616    /**
617     * @param value A number to uniquely reference the claim item entries.
618     */
619    public ItemComponent setItemSequence(int value) {
620      if (this.itemSequence == null)
621        this.itemSequence = new PositiveIntType();
622      this.itemSequence.setValue(value);
623      return this;
624    }
625
626    /**
627     * @return {@link #noteNumber} (The numbers associated with notes below which
628     *         apply to the adjudication of this item.)
629     */
630    public List<PositiveIntType> getNoteNumber() {
631      if (this.noteNumber == null)
632        this.noteNumber = new ArrayList<PositiveIntType>();
633      return this.noteNumber;
634    }
635
636    /**
637     * @return Returns a reference to <code>this</code> for easy method chaining
638     */
639    public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
640      this.noteNumber = theNoteNumber;
641      return this;
642    }
643
644    public boolean hasNoteNumber() {
645      if (this.noteNumber == null)
646        return false;
647      for (PositiveIntType item : this.noteNumber)
648        if (!item.isEmpty())
649          return true;
650      return false;
651    }
652
653    /**
654     * @return {@link #noteNumber} (The numbers associated with notes below which
655     *         apply to the adjudication of this item.)
656     */
657    public PositiveIntType addNoteNumberElement() {// 2
658      PositiveIntType t = new PositiveIntType();
659      if (this.noteNumber == null)
660        this.noteNumber = new ArrayList<PositiveIntType>();
661      this.noteNumber.add(t);
662      return t;
663    }
664
665    /**
666     * @param value {@link #noteNumber} (The numbers associated with notes below
667     *              which apply to the adjudication of this item.)
668     */
669    public ItemComponent addNoteNumber(int value) { // 1
670      PositiveIntType t = new PositiveIntType();
671      t.setValue(value);
672      if (this.noteNumber == null)
673        this.noteNumber = new ArrayList<PositiveIntType>();
674      this.noteNumber.add(t);
675      return this;
676    }
677
678    /**
679     * @param value {@link #noteNumber} (The numbers associated with notes below
680     *              which apply to the adjudication of this item.)
681     */
682    public boolean hasNoteNumber(int value) {
683      if (this.noteNumber == null)
684        return false;
685      for (PositiveIntType v : this.noteNumber)
686        if (v.getValue().equals(value)) // positiveInt
687          return true;
688      return false;
689    }
690
691    /**
692     * @return {@link #adjudication} (If this item is a group then the values here
693     *         are a summary of the adjudication of the detail items. If this item
694     *         is a simple product or service then this is the result of the
695     *         adjudication of this item.)
696     */
697    public List<AdjudicationComponent> getAdjudication() {
698      if (this.adjudication == null)
699        this.adjudication = new ArrayList<AdjudicationComponent>();
700      return this.adjudication;
701    }
702
703    /**
704     * @return Returns a reference to <code>this</code> for easy method chaining
705     */
706    public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
707      this.adjudication = theAdjudication;
708      return this;
709    }
710
711    public boolean hasAdjudication() {
712      if (this.adjudication == null)
713        return false;
714      for (AdjudicationComponent item : this.adjudication)
715        if (!item.isEmpty())
716          return true;
717      return false;
718    }
719
720    public AdjudicationComponent addAdjudication() { // 3
721      AdjudicationComponent t = new AdjudicationComponent();
722      if (this.adjudication == null)
723        this.adjudication = new ArrayList<AdjudicationComponent>();
724      this.adjudication.add(t);
725      return t;
726    }
727
728    public ItemComponent addAdjudication(AdjudicationComponent t) { // 3
729      if (t == null)
730        return this;
731      if (this.adjudication == null)
732        this.adjudication = new ArrayList<AdjudicationComponent>();
733      this.adjudication.add(t);
734      return this;
735    }
736
737    /**
738     * @return The first repetition of repeating field {@link #adjudication},
739     *         creating it if it does not already exist
740     */
741    public AdjudicationComponent getAdjudicationFirstRep() {
742      if (getAdjudication().isEmpty()) {
743        addAdjudication();
744      }
745      return getAdjudication().get(0);
746    }
747
748    /**
749     * @return {@link #detail} (A claim detail. Either a simple (a product or
750     *         service) or a 'group' of sub-details which are simple items.)
751     */
752    public List<ItemDetailComponent> getDetail() {
753      if (this.detail == null)
754        this.detail = new ArrayList<ItemDetailComponent>();
755      return this.detail;
756    }
757
758    /**
759     * @return Returns a reference to <code>this</code> for easy method chaining
760     */
761    public ItemComponent setDetail(List<ItemDetailComponent> theDetail) {
762      this.detail = theDetail;
763      return this;
764    }
765
766    public boolean hasDetail() {
767      if (this.detail == null)
768        return false;
769      for (ItemDetailComponent item : this.detail)
770        if (!item.isEmpty())
771          return true;
772      return false;
773    }
774
775    public ItemDetailComponent addDetail() { // 3
776      ItemDetailComponent t = new ItemDetailComponent();
777      if (this.detail == null)
778        this.detail = new ArrayList<ItemDetailComponent>();
779      this.detail.add(t);
780      return t;
781    }
782
783    public ItemComponent addDetail(ItemDetailComponent t) { // 3
784      if (t == null)
785        return this;
786      if (this.detail == null)
787        this.detail = new ArrayList<ItemDetailComponent>();
788      this.detail.add(t);
789      return this;
790    }
791
792    /**
793     * @return The first repetition of repeating field {@link #detail}, creating it
794     *         if it does not already exist
795     */
796    public ItemDetailComponent getDetailFirstRep() {
797      if (getDetail().isEmpty()) {
798        addDetail();
799      }
800      return getDetail().get(0);
801    }
802
803    protected void listChildren(List<Property> children) {
804      super.listChildren(children);
805      children.add(new Property("itemSequence", "positiveInt", "A number to uniquely reference the claim item entries.",
806          0, 1, itemSequence));
807      children.add(new Property("noteNumber", "positiveInt",
808          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
809          java.lang.Integer.MAX_VALUE, noteNumber));
810      children.add(new Property("adjudication", "",
811          "If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.",
812          0, java.lang.Integer.MAX_VALUE, adjudication));
813      children.add(new Property("detail", "",
814          "A claim detail. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
815          0, java.lang.Integer.MAX_VALUE, detail));
816    }
817
818    @Override
819    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
820      switch (_hash) {
821      case 1977979892:
822        /* itemSequence */ return new Property("itemSequence", "positiveInt",
823            "A number to uniquely reference the claim item entries.", 0, 1, itemSequence);
824      case -1110033957:
825        /* noteNumber */ return new Property("noteNumber", "positiveInt",
826            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
827            java.lang.Integer.MAX_VALUE, noteNumber);
828      case -231349275:
829        /* adjudication */ return new Property("adjudication", "",
830            "If this item is a group then the values here are a summary of the adjudication of the detail items. If this item is a simple product or service then this is the result of the adjudication of this item.",
831            0, java.lang.Integer.MAX_VALUE, adjudication);
832      case -1335224239:
833        /* detail */ return new Property("detail", "",
834            "A claim detail. Either a simple (a product or service) or a 'group' of sub-details which are simple items.",
835            0, java.lang.Integer.MAX_VALUE, detail);
836      default:
837        return super.getNamedProperty(_hash, _name, _checkValid);
838      }
839
840    }
841
842    @Override
843    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
844      switch (hash) {
845      case 1977979892:
846        /* itemSequence */ return this.itemSequence == null ? new Base[0] : new Base[] { this.itemSequence }; // PositiveIntType
847      case -1110033957:
848        /* noteNumber */ return this.noteNumber == null ? new Base[0]
849            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
850      case -231349275:
851        /* adjudication */ return this.adjudication == null ? new Base[0]
852            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
853      case -1335224239:
854        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // ItemDetailComponent
855      default:
856        return super.getProperty(hash, name, checkValid);
857      }
858
859    }
860
861    @Override
862    public Base setProperty(int hash, String name, Base value) throws FHIRException {
863      switch (hash) {
864      case 1977979892: // itemSequence
865        this.itemSequence = castToPositiveInt(value); // PositiveIntType
866        return value;
867      case -1110033957: // noteNumber
868        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
869        return value;
870      case -231349275: // adjudication
871        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
872        return value;
873      case -1335224239: // detail
874        this.getDetail().add((ItemDetailComponent) value); // ItemDetailComponent
875        return value;
876      default:
877        return super.setProperty(hash, name, value);
878      }
879
880    }
881
882    @Override
883    public Base setProperty(String name, Base value) throws FHIRException {
884      if (name.equals("itemSequence")) {
885        this.itemSequence = castToPositiveInt(value); // PositiveIntType
886      } else if (name.equals("noteNumber")) {
887        this.getNoteNumber().add(castToPositiveInt(value));
888      } else if (name.equals("adjudication")) {
889        this.getAdjudication().add((AdjudicationComponent) value);
890      } else if (name.equals("detail")) {
891        this.getDetail().add((ItemDetailComponent) value);
892      } else
893        return super.setProperty(name, value);
894      return value;
895    }
896
897    @Override
898    public Base makeProperty(int hash, String name) throws FHIRException {
899      switch (hash) {
900      case 1977979892:
901        return getItemSequenceElement();
902      case -1110033957:
903        return addNoteNumberElement();
904      case -231349275:
905        return addAdjudication();
906      case -1335224239:
907        return addDetail();
908      default:
909        return super.makeProperty(hash, name);
910      }
911
912    }
913
914    @Override
915    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
916      switch (hash) {
917      case 1977979892:
918        /* itemSequence */ return new String[] { "positiveInt" };
919      case -1110033957:
920        /* noteNumber */ return new String[] { "positiveInt" };
921      case -231349275:
922        /* adjudication */ return new String[] {};
923      case -1335224239:
924        /* detail */ return new String[] {};
925      default:
926        return super.getTypesForProperty(hash, name);
927      }
928
929    }
930
931    @Override
932    public Base addChild(String name) throws FHIRException {
933      if (name.equals("itemSequence")) {
934        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.itemSequence");
935      } else if (name.equals("noteNumber")) {
936        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.noteNumber");
937      } else if (name.equals("adjudication")) {
938        return addAdjudication();
939      } else if (name.equals("detail")) {
940        return addDetail();
941      } else
942        return super.addChild(name);
943    }
944
945    public ItemComponent copy() {
946      ItemComponent dst = new ItemComponent();
947      copyValues(dst);
948      return dst;
949    }
950
951    public void copyValues(ItemComponent dst) {
952      super.copyValues(dst);
953      dst.itemSequence = itemSequence == null ? null : itemSequence.copy();
954      if (noteNumber != null) {
955        dst.noteNumber = new ArrayList<PositiveIntType>();
956        for (PositiveIntType i : noteNumber)
957          dst.noteNumber.add(i.copy());
958      }
959      ;
960      if (adjudication != null) {
961        dst.adjudication = new ArrayList<AdjudicationComponent>();
962        for (AdjudicationComponent i : adjudication)
963          dst.adjudication.add(i.copy());
964      }
965      ;
966      if (detail != null) {
967        dst.detail = new ArrayList<ItemDetailComponent>();
968        for (ItemDetailComponent i : detail)
969          dst.detail.add(i.copy());
970      }
971      ;
972    }
973
974    @Override
975    public boolean equalsDeep(Base other_) {
976      if (!super.equalsDeep(other_))
977        return false;
978      if (!(other_ instanceof ItemComponent))
979        return false;
980      ItemComponent o = (ItemComponent) other_;
981      return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(noteNumber, o.noteNumber, true)
982          && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
983    }
984
985    @Override
986    public boolean equalsShallow(Base other_) {
987      if (!super.equalsShallow(other_))
988        return false;
989      if (!(other_ instanceof ItemComponent))
990        return false;
991      ItemComponent o = (ItemComponent) other_;
992      return compareValues(itemSequence, o.itemSequence, true) && compareValues(noteNumber, o.noteNumber, true);
993    }
994
995    public boolean isEmpty() {
996      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, noteNumber, adjudication, detail);
997    }
998
999    public String fhirType() {
1000      return "ClaimResponse.item";
1001
1002    }
1003
1004  }
1005
1006  @Block()
1007  public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
1008    /**
1009     * A code to indicate the information type of this adjudication record.
1010     * Information types may include the value submitted, maximum values or
1011     * percentages allowed or payable under the plan, amounts that: the patient is
1012     * responsible for in aggregate or pertaining to this item; amounts paid by
1013     * other coverages; and, the benefit payable for this item.
1014     */
1015    @Child(name = "category", type = {
1016        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1017    @Description(shortDefinition = "Type of adjudication information", formalDefinition = "A code to indicate the information type of this adjudication record. Information types may include the value submitted, maximum values or percentages allowed or payable under the plan, amounts that: the patient is responsible for in aggregate or pertaining to this item; amounts paid by other coverages; and, the benefit payable for this item.")
1018    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication")
1019    protected CodeableConcept category;
1020
1021    /**
1022     * A code supporting the understanding of the adjudication result and explaining
1023     * variance from expected amount.
1024     */
1025    @Child(name = "reason", type = {
1026        CodeableConcept.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
1027    @Description(shortDefinition = "Explanation of adjudication outcome", formalDefinition = "A code supporting the understanding of the adjudication result and explaining variance from expected amount.")
1028    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication-reason")
1029    protected CodeableConcept reason;
1030
1031    /**
1032     * Monetary amount associated with the category.
1033     */
1034    @Child(name = "amount", type = { Money.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
1035    @Description(shortDefinition = "Monetary amount", formalDefinition = "Monetary amount associated with the category.")
1036    protected Money amount;
1037
1038    /**
1039     * A non-monetary value associated with the category. Mutually exclusive to the
1040     * amount element above.
1041     */
1042    @Child(name = "value", type = { DecimalType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
1043    @Description(shortDefinition = "Non-monetary value", formalDefinition = "A non-monetary value associated with the category. Mutually exclusive to the amount element above.")
1044    protected DecimalType value;
1045
1046    private static final long serialVersionUID = 1559898786L;
1047
1048    /**
1049     * Constructor
1050     */
1051    public AdjudicationComponent() {
1052      super();
1053    }
1054
1055    /**
1056     * Constructor
1057     */
1058    public AdjudicationComponent(CodeableConcept category) {
1059      super();
1060      this.category = category;
1061    }
1062
1063    /**
1064     * @return {@link #category} (A code to indicate the information type of this
1065     *         adjudication record. Information types may include the value
1066     *         submitted, maximum values or percentages allowed or payable under the
1067     *         plan, amounts that: the patient is responsible for in aggregate or
1068     *         pertaining to this item; amounts paid by other coverages; and, the
1069     *         benefit payable for this item.)
1070     */
1071    public CodeableConcept getCategory() {
1072      if (this.category == null)
1073        if (Configuration.errorOnAutoCreate())
1074          throw new Error("Attempt to auto-create AdjudicationComponent.category");
1075        else if (Configuration.doAutoCreate())
1076          this.category = new CodeableConcept(); // cc
1077      return this.category;
1078    }
1079
1080    public boolean hasCategory() {
1081      return this.category != null && !this.category.isEmpty();
1082    }
1083
1084    /**
1085     * @param value {@link #category} (A code to indicate the information type of
1086     *              this adjudication record. Information types may include the
1087     *              value submitted, maximum values or percentages allowed or
1088     *              payable under the plan, amounts that: the patient is responsible
1089     *              for in aggregate or pertaining to this item; amounts paid by
1090     *              other coverages; and, the benefit payable for this item.)
1091     */
1092    public AdjudicationComponent setCategory(CodeableConcept value) {
1093      this.category = value;
1094      return this;
1095    }
1096
1097    /**
1098     * @return {@link #reason} (A code supporting the understanding of the
1099     *         adjudication result and explaining variance from expected amount.)
1100     */
1101    public CodeableConcept getReason() {
1102      if (this.reason == null)
1103        if (Configuration.errorOnAutoCreate())
1104          throw new Error("Attempt to auto-create AdjudicationComponent.reason");
1105        else if (Configuration.doAutoCreate())
1106          this.reason = new CodeableConcept(); // cc
1107      return this.reason;
1108    }
1109
1110    public boolean hasReason() {
1111      return this.reason != null && !this.reason.isEmpty();
1112    }
1113
1114    /**
1115     * @param value {@link #reason} (A code supporting the understanding of the
1116     *              adjudication result and explaining variance from expected
1117     *              amount.)
1118     */
1119    public AdjudicationComponent setReason(CodeableConcept value) {
1120      this.reason = value;
1121      return this;
1122    }
1123
1124    /**
1125     * @return {@link #amount} (Monetary amount associated with the category.)
1126     */
1127    public Money getAmount() {
1128      if (this.amount == null)
1129        if (Configuration.errorOnAutoCreate())
1130          throw new Error("Attempt to auto-create AdjudicationComponent.amount");
1131        else if (Configuration.doAutoCreate())
1132          this.amount = new Money(); // cc
1133      return this.amount;
1134    }
1135
1136    public boolean hasAmount() {
1137      return this.amount != null && !this.amount.isEmpty();
1138    }
1139
1140    /**
1141     * @param value {@link #amount} (Monetary amount associated with the category.)
1142     */
1143    public AdjudicationComponent setAmount(Money value) {
1144      this.amount = value;
1145      return this;
1146    }
1147
1148    /**
1149     * @return {@link #value} (A non-monetary value associated with the category.
1150     *         Mutually exclusive to the amount element above.). This is the
1151     *         underlying object with id, value and extensions. The accessor
1152     *         "getValue" gives direct access to the value
1153     */
1154    public DecimalType getValueElement() {
1155      if (this.value == null)
1156        if (Configuration.errorOnAutoCreate())
1157          throw new Error("Attempt to auto-create AdjudicationComponent.value");
1158        else if (Configuration.doAutoCreate())
1159          this.value = new DecimalType(); // bb
1160      return this.value;
1161    }
1162
1163    public boolean hasValueElement() {
1164      return this.value != null && !this.value.isEmpty();
1165    }
1166
1167    public boolean hasValue() {
1168      return this.value != null && !this.value.isEmpty();
1169    }
1170
1171    /**
1172     * @param value {@link #value} (A non-monetary value associated with the
1173     *              category. Mutually exclusive to the amount element above.). This
1174     *              is the underlying object with id, value and extensions. The
1175     *              accessor "getValue" gives direct access to the value
1176     */
1177    public AdjudicationComponent setValueElement(DecimalType value) {
1178      this.value = value;
1179      return this;
1180    }
1181
1182    /**
1183     * @return A non-monetary value associated with the category. Mutually exclusive
1184     *         to the amount element above.
1185     */
1186    public BigDecimal getValue() {
1187      return this.value == null ? null : this.value.getValue();
1188    }
1189
1190    /**
1191     * @param value A non-monetary value associated with the category. Mutually
1192     *              exclusive to the amount element above.
1193     */
1194    public AdjudicationComponent setValue(BigDecimal value) {
1195      if (value == null)
1196        this.value = null;
1197      else {
1198        if (this.value == null)
1199          this.value = new DecimalType();
1200        this.value.setValue(value);
1201      }
1202      return this;
1203    }
1204
1205    /**
1206     * @param value A non-monetary value associated with the category. Mutually
1207     *              exclusive to the amount element above.
1208     */
1209    public AdjudicationComponent setValue(long value) {
1210      this.value = new DecimalType();
1211      this.value.setValue(value);
1212      return this;
1213    }
1214
1215    /**
1216     * @param value A non-monetary value associated with the category. Mutually
1217     *              exclusive to the amount element above.
1218     */
1219    public AdjudicationComponent setValue(double value) {
1220      this.value = new DecimalType();
1221      this.value.setValue(value);
1222      return this;
1223    }
1224
1225    protected void listChildren(List<Property> children) {
1226      super.listChildren(children);
1227      children.add(new Property("category", "CodeableConcept",
1228          "A code to indicate the information type of this adjudication record. Information types may include the value submitted, maximum values or percentages allowed or payable under the plan, amounts that: the patient is responsible for in aggregate or pertaining to this item; amounts paid by other coverages; and, the benefit payable for this item.",
1229          0, 1, category));
1230      children.add(new Property("reason", "CodeableConcept",
1231          "A code supporting the understanding of the adjudication result and explaining variance from expected amount.",
1232          0, 1, reason));
1233      children.add(new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1, amount));
1234      children.add(new Property("value", "decimal",
1235          "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1,
1236          value));
1237    }
1238
1239    @Override
1240    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1241      switch (_hash) {
1242      case 50511102:
1243        /* category */ return new Property("category", "CodeableConcept",
1244            "A code to indicate the information type of this adjudication record. Information types may include the value submitted, maximum values or percentages allowed or payable under the plan, amounts that: the patient is responsible for in aggregate or pertaining to this item; amounts paid by other coverages; and, the benefit payable for this item.",
1245            0, 1, category);
1246      case -934964668:
1247        /* reason */ return new Property("reason", "CodeableConcept",
1248            "A code supporting the understanding of the adjudication result and explaining variance from expected amount.",
1249            0, 1, reason);
1250      case -1413853096:
1251        /* amount */ return new Property("amount", "Money", "Monetary amount associated with the category.", 0, 1,
1252            amount);
1253      case 111972721:
1254        /* value */ return new Property("value", "decimal",
1255            "A non-monetary value associated with the category. Mutually exclusive to the amount element above.", 0, 1,
1256            value);
1257      default:
1258        return super.getNamedProperty(_hash, _name, _checkValid);
1259      }
1260
1261    }
1262
1263    @Override
1264    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1265      switch (hash) {
1266      case 50511102:
1267        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
1268      case -934964668:
1269        /* reason */ return this.reason == null ? new Base[0] : new Base[] { this.reason }; // CodeableConcept
1270      case -1413853096:
1271        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
1272      case 111972721:
1273        /* value */ return this.value == null ? new Base[0] : new Base[] { this.value }; // DecimalType
1274      default:
1275        return super.getProperty(hash, name, checkValid);
1276      }
1277
1278    }
1279
1280    @Override
1281    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1282      switch (hash) {
1283      case 50511102: // category
1284        this.category = castToCodeableConcept(value); // CodeableConcept
1285        return value;
1286      case -934964668: // reason
1287        this.reason = castToCodeableConcept(value); // CodeableConcept
1288        return value;
1289      case -1413853096: // amount
1290        this.amount = castToMoney(value); // Money
1291        return value;
1292      case 111972721: // value
1293        this.value = castToDecimal(value); // DecimalType
1294        return value;
1295      default:
1296        return super.setProperty(hash, name, value);
1297      }
1298
1299    }
1300
1301    @Override
1302    public Base setProperty(String name, Base value) throws FHIRException {
1303      if (name.equals("category")) {
1304        this.category = castToCodeableConcept(value); // CodeableConcept
1305      } else if (name.equals("reason")) {
1306        this.reason = castToCodeableConcept(value); // CodeableConcept
1307      } else if (name.equals("amount")) {
1308        this.amount = castToMoney(value); // Money
1309      } else if (name.equals("value")) {
1310        this.value = castToDecimal(value); // DecimalType
1311      } else
1312        return super.setProperty(name, value);
1313      return value;
1314    }
1315
1316    @Override
1317    public Base makeProperty(int hash, String name) throws FHIRException {
1318      switch (hash) {
1319      case 50511102:
1320        return getCategory();
1321      case -934964668:
1322        return getReason();
1323      case -1413853096:
1324        return getAmount();
1325      case 111972721:
1326        return getValueElement();
1327      default:
1328        return super.makeProperty(hash, name);
1329      }
1330
1331    }
1332
1333    @Override
1334    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1335      switch (hash) {
1336      case 50511102:
1337        /* category */ return new String[] { "CodeableConcept" };
1338      case -934964668:
1339        /* reason */ return new String[] { "CodeableConcept" };
1340      case -1413853096:
1341        /* amount */ return new String[] { "Money" };
1342      case 111972721:
1343        /* value */ return new String[] { "decimal" };
1344      default:
1345        return super.getTypesForProperty(hash, name);
1346      }
1347
1348    }
1349
1350    @Override
1351    public Base addChild(String name) throws FHIRException {
1352      if (name.equals("category")) {
1353        this.category = new CodeableConcept();
1354        return this.category;
1355      } else if (name.equals("reason")) {
1356        this.reason = new CodeableConcept();
1357        return this.reason;
1358      } else if (name.equals("amount")) {
1359        this.amount = new Money();
1360        return this.amount;
1361      } else if (name.equals("value")) {
1362        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.value");
1363      } else
1364        return super.addChild(name);
1365    }
1366
1367    public AdjudicationComponent copy() {
1368      AdjudicationComponent dst = new AdjudicationComponent();
1369      copyValues(dst);
1370      return dst;
1371    }
1372
1373    public void copyValues(AdjudicationComponent dst) {
1374      super.copyValues(dst);
1375      dst.category = category == null ? null : category.copy();
1376      dst.reason = reason == null ? null : reason.copy();
1377      dst.amount = amount == null ? null : amount.copy();
1378      dst.value = value == null ? null : value.copy();
1379    }
1380
1381    @Override
1382    public boolean equalsDeep(Base other_) {
1383      if (!super.equalsDeep(other_))
1384        return false;
1385      if (!(other_ instanceof AdjudicationComponent))
1386        return false;
1387      AdjudicationComponent o = (AdjudicationComponent) other_;
1388      return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true)
1389          && compareDeep(amount, o.amount, true) && compareDeep(value, o.value, true);
1390    }
1391
1392    @Override
1393    public boolean equalsShallow(Base other_) {
1394      if (!super.equalsShallow(other_))
1395        return false;
1396      if (!(other_ instanceof AdjudicationComponent))
1397        return false;
1398      AdjudicationComponent o = (AdjudicationComponent) other_;
1399      return compareValues(value, o.value, true);
1400    }
1401
1402    public boolean isEmpty() {
1403      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount, value);
1404    }
1405
1406    public String fhirType() {
1407      return "ClaimResponse.item.adjudication";
1408
1409    }
1410
1411  }
1412
1413  @Block()
1414  public static class ItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
1415    /**
1416     * A number to uniquely reference the claim detail entry.
1417     */
1418    @Child(name = "detailSequence", type = {
1419        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1420    @Description(shortDefinition = "Claim detail instance identifier", formalDefinition = "A number to uniquely reference the claim detail entry.")
1421    protected PositiveIntType detailSequence;
1422
1423    /**
1424     * The numbers associated with notes below which apply to the adjudication of
1425     * this item.
1426     */
1427    @Child(name = "noteNumber", type = {
1428        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1429    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
1430    protected List<PositiveIntType> noteNumber;
1431
1432    /**
1433     * The adjudication results.
1434     */
1435    @Child(name = "adjudication", type = {
1436        AdjudicationComponent.class }, order = 3, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1437    @Description(shortDefinition = "Detail level adjudication details", formalDefinition = "The adjudication results.")
1438    protected List<AdjudicationComponent> adjudication;
1439
1440    /**
1441     * A sub-detail adjudication of a simple product or service.
1442     */
1443    @Child(name = "subDetail", type = {}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1444    @Description(shortDefinition = "Adjudication for claim sub-details", formalDefinition = "A sub-detail adjudication of a simple product or service.")
1445    protected List<SubDetailComponent> subDetail;
1446
1447    private static final long serialVersionUID = 1066636111L;
1448
1449    /**
1450     * Constructor
1451     */
1452    public ItemDetailComponent() {
1453      super();
1454    }
1455
1456    /**
1457     * Constructor
1458     */
1459    public ItemDetailComponent(PositiveIntType detailSequence) {
1460      super();
1461      this.detailSequence = detailSequence;
1462    }
1463
1464    /**
1465     * @return {@link #detailSequence} (A number to uniquely reference the claim
1466     *         detail entry.). This is the underlying object with id, value and
1467     *         extensions. The accessor "getDetailSequence" gives direct access to
1468     *         the value
1469     */
1470    public PositiveIntType getDetailSequenceElement() {
1471      if (this.detailSequence == null)
1472        if (Configuration.errorOnAutoCreate())
1473          throw new Error("Attempt to auto-create ItemDetailComponent.detailSequence");
1474        else if (Configuration.doAutoCreate())
1475          this.detailSequence = new PositiveIntType(); // bb
1476      return this.detailSequence;
1477    }
1478
1479    public boolean hasDetailSequenceElement() {
1480      return this.detailSequence != null && !this.detailSequence.isEmpty();
1481    }
1482
1483    public boolean hasDetailSequence() {
1484      return this.detailSequence != null && !this.detailSequence.isEmpty();
1485    }
1486
1487    /**
1488     * @param value {@link #detailSequence} (A number to uniquely reference the
1489     *              claim detail entry.). This is the underlying object with id,
1490     *              value and extensions. The accessor "getDetailSequence" gives
1491     *              direct access to the value
1492     */
1493    public ItemDetailComponent setDetailSequenceElement(PositiveIntType value) {
1494      this.detailSequence = value;
1495      return this;
1496    }
1497
1498    /**
1499     * @return A number to uniquely reference the claim detail entry.
1500     */
1501    public int getDetailSequence() {
1502      return this.detailSequence == null || this.detailSequence.isEmpty() ? 0 : this.detailSequence.getValue();
1503    }
1504
1505    /**
1506     * @param value A number to uniquely reference the claim detail entry.
1507     */
1508    public ItemDetailComponent setDetailSequence(int value) {
1509      if (this.detailSequence == null)
1510        this.detailSequence = new PositiveIntType();
1511      this.detailSequence.setValue(value);
1512      return this;
1513    }
1514
1515    /**
1516     * @return {@link #noteNumber} (The numbers associated with notes below which
1517     *         apply to the adjudication of this item.)
1518     */
1519    public List<PositiveIntType> getNoteNumber() {
1520      if (this.noteNumber == null)
1521        this.noteNumber = new ArrayList<PositiveIntType>();
1522      return this.noteNumber;
1523    }
1524
1525    /**
1526     * @return Returns a reference to <code>this</code> for easy method chaining
1527     */
1528    public ItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
1529      this.noteNumber = theNoteNumber;
1530      return this;
1531    }
1532
1533    public boolean hasNoteNumber() {
1534      if (this.noteNumber == null)
1535        return false;
1536      for (PositiveIntType item : this.noteNumber)
1537        if (!item.isEmpty())
1538          return true;
1539      return false;
1540    }
1541
1542    /**
1543     * @return {@link #noteNumber} (The numbers associated with notes below which
1544     *         apply to the adjudication of this item.)
1545     */
1546    public PositiveIntType addNoteNumberElement() {// 2
1547      PositiveIntType t = new PositiveIntType();
1548      if (this.noteNumber == null)
1549        this.noteNumber = new ArrayList<PositiveIntType>();
1550      this.noteNumber.add(t);
1551      return t;
1552    }
1553
1554    /**
1555     * @param value {@link #noteNumber} (The numbers associated with notes below
1556     *              which apply to the adjudication of this item.)
1557     */
1558    public ItemDetailComponent addNoteNumber(int value) { // 1
1559      PositiveIntType t = new PositiveIntType();
1560      t.setValue(value);
1561      if (this.noteNumber == null)
1562        this.noteNumber = new ArrayList<PositiveIntType>();
1563      this.noteNumber.add(t);
1564      return this;
1565    }
1566
1567    /**
1568     * @param value {@link #noteNumber} (The numbers associated with notes below
1569     *              which apply to the adjudication of this item.)
1570     */
1571    public boolean hasNoteNumber(int value) {
1572      if (this.noteNumber == null)
1573        return false;
1574      for (PositiveIntType v : this.noteNumber)
1575        if (v.getValue().equals(value)) // positiveInt
1576          return true;
1577      return false;
1578    }
1579
1580    /**
1581     * @return {@link #adjudication} (The adjudication results.)
1582     */
1583    public List<AdjudicationComponent> getAdjudication() {
1584      if (this.adjudication == null)
1585        this.adjudication = new ArrayList<AdjudicationComponent>();
1586      return this.adjudication;
1587    }
1588
1589    /**
1590     * @return Returns a reference to <code>this</code> for easy method chaining
1591     */
1592    public ItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
1593      this.adjudication = theAdjudication;
1594      return this;
1595    }
1596
1597    public boolean hasAdjudication() {
1598      if (this.adjudication == null)
1599        return false;
1600      for (AdjudicationComponent item : this.adjudication)
1601        if (!item.isEmpty())
1602          return true;
1603      return false;
1604    }
1605
1606    public AdjudicationComponent addAdjudication() { // 3
1607      AdjudicationComponent t = new AdjudicationComponent();
1608      if (this.adjudication == null)
1609        this.adjudication = new ArrayList<AdjudicationComponent>();
1610      this.adjudication.add(t);
1611      return t;
1612    }
1613
1614    public ItemDetailComponent addAdjudication(AdjudicationComponent t) { // 3
1615      if (t == null)
1616        return this;
1617      if (this.adjudication == null)
1618        this.adjudication = new ArrayList<AdjudicationComponent>();
1619      this.adjudication.add(t);
1620      return this;
1621    }
1622
1623    /**
1624     * @return The first repetition of repeating field {@link #adjudication},
1625     *         creating it if it does not already exist
1626     */
1627    public AdjudicationComponent getAdjudicationFirstRep() {
1628      if (getAdjudication().isEmpty()) {
1629        addAdjudication();
1630      }
1631      return getAdjudication().get(0);
1632    }
1633
1634    /**
1635     * @return {@link #subDetail} (A sub-detail adjudication of a simple product or
1636     *         service.)
1637     */
1638    public List<SubDetailComponent> getSubDetail() {
1639      if (this.subDetail == null)
1640        this.subDetail = new ArrayList<SubDetailComponent>();
1641      return this.subDetail;
1642    }
1643
1644    /**
1645     * @return Returns a reference to <code>this</code> for easy method chaining
1646     */
1647    public ItemDetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) {
1648      this.subDetail = theSubDetail;
1649      return this;
1650    }
1651
1652    public boolean hasSubDetail() {
1653      if (this.subDetail == null)
1654        return false;
1655      for (SubDetailComponent item : this.subDetail)
1656        if (!item.isEmpty())
1657          return true;
1658      return false;
1659    }
1660
1661    public SubDetailComponent addSubDetail() { // 3
1662      SubDetailComponent t = new SubDetailComponent();
1663      if (this.subDetail == null)
1664        this.subDetail = new ArrayList<SubDetailComponent>();
1665      this.subDetail.add(t);
1666      return t;
1667    }
1668
1669    public ItemDetailComponent addSubDetail(SubDetailComponent t) { // 3
1670      if (t == null)
1671        return this;
1672      if (this.subDetail == null)
1673        this.subDetail = new ArrayList<SubDetailComponent>();
1674      this.subDetail.add(t);
1675      return this;
1676    }
1677
1678    /**
1679     * @return The first repetition of repeating field {@link #subDetail}, creating
1680     *         it if it does not already exist
1681     */
1682    public SubDetailComponent getSubDetailFirstRep() {
1683      if (getSubDetail().isEmpty()) {
1684        addSubDetail();
1685      }
1686      return getSubDetail().get(0);
1687    }
1688
1689    protected void listChildren(List<Property> children) {
1690      super.listChildren(children);
1691      children.add(new Property("detailSequence", "positiveInt",
1692          "A number to uniquely reference the claim detail entry.", 0, 1, detailSequence));
1693      children.add(new Property("noteNumber", "positiveInt",
1694          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
1695          java.lang.Integer.MAX_VALUE, noteNumber));
1696      children.add(new Property("adjudication", "@ClaimResponse.item.adjudication", "The adjudication results.", 0,
1697          java.lang.Integer.MAX_VALUE, adjudication));
1698      children.add(new Property("subDetail", "", "A sub-detail adjudication of a simple product or service.", 0,
1699          java.lang.Integer.MAX_VALUE, subDetail));
1700    }
1701
1702    @Override
1703    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
1704      switch (_hash) {
1705      case 1321472818:
1706        /* detailSequence */ return new Property("detailSequence", "positiveInt",
1707            "A number to uniquely reference the claim detail entry.", 0, 1, detailSequence);
1708      case -1110033957:
1709        /* noteNumber */ return new Property("noteNumber", "positiveInt",
1710            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
1711            java.lang.Integer.MAX_VALUE, noteNumber);
1712      case -231349275:
1713        /* adjudication */ return new Property("adjudication", "@ClaimResponse.item.adjudication",
1714            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
1715      case -828829007:
1716        /* subDetail */ return new Property("subDetail", "",
1717            "A sub-detail adjudication of a simple product or service.", 0, java.lang.Integer.MAX_VALUE, subDetail);
1718      default:
1719        return super.getNamedProperty(_hash, _name, _checkValid);
1720      }
1721
1722    }
1723
1724    @Override
1725    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1726      switch (hash) {
1727      case 1321472818:
1728        /* detailSequence */ return this.detailSequence == null ? new Base[0] : new Base[] { this.detailSequence }; // PositiveIntType
1729      case -1110033957:
1730        /* noteNumber */ return this.noteNumber == null ? new Base[0]
1731            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
1732      case -231349275:
1733        /* adjudication */ return this.adjudication == null ? new Base[0]
1734            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
1735      case -828829007:
1736        /* subDetail */ return this.subDetail == null ? new Base[0]
1737            : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
1738      default:
1739        return super.getProperty(hash, name, checkValid);
1740      }
1741
1742    }
1743
1744    @Override
1745    public Base setProperty(int hash, String name, Base value) throws FHIRException {
1746      switch (hash) {
1747      case 1321472818: // detailSequence
1748        this.detailSequence = castToPositiveInt(value); // PositiveIntType
1749        return value;
1750      case -1110033957: // noteNumber
1751        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
1752        return value;
1753      case -231349275: // adjudication
1754        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
1755        return value;
1756      case -828829007: // subDetail
1757        this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
1758        return value;
1759      default:
1760        return super.setProperty(hash, name, value);
1761      }
1762
1763    }
1764
1765    @Override
1766    public Base setProperty(String name, Base value) throws FHIRException {
1767      if (name.equals("detailSequence")) {
1768        this.detailSequence = castToPositiveInt(value); // PositiveIntType
1769      } else if (name.equals("noteNumber")) {
1770        this.getNoteNumber().add(castToPositiveInt(value));
1771      } else if (name.equals("adjudication")) {
1772        this.getAdjudication().add((AdjudicationComponent) value);
1773      } else if (name.equals("subDetail")) {
1774        this.getSubDetail().add((SubDetailComponent) value);
1775      } else
1776        return super.setProperty(name, value);
1777      return value;
1778    }
1779
1780    @Override
1781    public Base makeProperty(int hash, String name) throws FHIRException {
1782      switch (hash) {
1783      case 1321472818:
1784        return getDetailSequenceElement();
1785      case -1110033957:
1786        return addNoteNumberElement();
1787      case -231349275:
1788        return addAdjudication();
1789      case -828829007:
1790        return addSubDetail();
1791      default:
1792        return super.makeProperty(hash, name);
1793      }
1794
1795    }
1796
1797    @Override
1798    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1799      switch (hash) {
1800      case 1321472818:
1801        /* detailSequence */ return new String[] { "positiveInt" };
1802      case -1110033957:
1803        /* noteNumber */ return new String[] { "positiveInt" };
1804      case -231349275:
1805        /* adjudication */ return new String[] { "@ClaimResponse.item.adjudication" };
1806      case -828829007:
1807        /* subDetail */ return new String[] {};
1808      default:
1809        return super.getTypesForProperty(hash, name);
1810      }
1811
1812    }
1813
1814    @Override
1815    public Base addChild(String name) throws FHIRException {
1816      if (name.equals("detailSequence")) {
1817        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.detailSequence");
1818      } else if (name.equals("noteNumber")) {
1819        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.noteNumber");
1820      } else if (name.equals("adjudication")) {
1821        return addAdjudication();
1822      } else if (name.equals("subDetail")) {
1823        return addSubDetail();
1824      } else
1825        return super.addChild(name);
1826    }
1827
1828    public ItemDetailComponent copy() {
1829      ItemDetailComponent dst = new ItemDetailComponent();
1830      copyValues(dst);
1831      return dst;
1832    }
1833
1834    public void copyValues(ItemDetailComponent dst) {
1835      super.copyValues(dst);
1836      dst.detailSequence = detailSequence == null ? null : detailSequence.copy();
1837      if (noteNumber != null) {
1838        dst.noteNumber = new ArrayList<PositiveIntType>();
1839        for (PositiveIntType i : noteNumber)
1840          dst.noteNumber.add(i.copy());
1841      }
1842      ;
1843      if (adjudication != null) {
1844        dst.adjudication = new ArrayList<AdjudicationComponent>();
1845        for (AdjudicationComponent i : adjudication)
1846          dst.adjudication.add(i.copy());
1847      }
1848      ;
1849      if (subDetail != null) {
1850        dst.subDetail = new ArrayList<SubDetailComponent>();
1851        for (SubDetailComponent i : subDetail)
1852          dst.subDetail.add(i.copy());
1853      }
1854      ;
1855    }
1856
1857    @Override
1858    public boolean equalsDeep(Base other_) {
1859      if (!super.equalsDeep(other_))
1860        return false;
1861      if (!(other_ instanceof ItemDetailComponent))
1862        return false;
1863      ItemDetailComponent o = (ItemDetailComponent) other_;
1864      return compareDeep(detailSequence, o.detailSequence, true) && compareDeep(noteNumber, o.noteNumber, true)
1865          && compareDeep(adjudication, o.adjudication, true) && compareDeep(subDetail, o.subDetail, true);
1866    }
1867
1868    @Override
1869    public boolean equalsShallow(Base other_) {
1870      if (!super.equalsShallow(other_))
1871        return false;
1872      if (!(other_ instanceof ItemDetailComponent))
1873        return false;
1874      ItemDetailComponent o = (ItemDetailComponent) other_;
1875      return compareValues(detailSequence, o.detailSequence, true) && compareValues(noteNumber, o.noteNumber, true);
1876    }
1877
1878    public boolean isEmpty() {
1879      return super.isEmpty()
1880          && ca.uhn.fhir.util.ElementUtil.isEmpty(detailSequence, noteNumber, adjudication, subDetail);
1881    }
1882
1883    public String fhirType() {
1884      return "ClaimResponse.item.detail";
1885
1886    }
1887
1888  }
1889
1890  @Block()
1891  public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
1892    /**
1893     * A number to uniquely reference the claim sub-detail entry.
1894     */
1895    @Child(name = "subDetailSequence", type = {
1896        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
1897    @Description(shortDefinition = "Claim sub-detail instance identifier", formalDefinition = "A number to uniquely reference the claim sub-detail entry.")
1898    protected PositiveIntType subDetailSequence;
1899
1900    /**
1901     * The numbers associated with notes below which apply to the adjudication of
1902     * this item.
1903     */
1904    @Child(name = "noteNumber", type = {
1905        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1906    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
1907    protected List<PositiveIntType> noteNumber;
1908
1909    /**
1910     * The adjudication results.
1911     */
1912    @Child(name = "adjudication", type = {
1913        AdjudicationComponent.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
1914    @Description(shortDefinition = "Subdetail level adjudication details", formalDefinition = "The adjudication results.")
1915    protected List<AdjudicationComponent> adjudication;
1916
1917    private static final long serialVersionUID = -1083724362L;
1918
1919    /**
1920     * Constructor
1921     */
1922    public SubDetailComponent() {
1923      super();
1924    }
1925
1926    /**
1927     * Constructor
1928     */
1929    public SubDetailComponent(PositiveIntType subDetailSequence) {
1930      super();
1931      this.subDetailSequence = subDetailSequence;
1932    }
1933
1934    /**
1935     * @return {@link #subDetailSequence} (A number to uniquely reference the claim
1936     *         sub-detail entry.). This is the underlying object with id, value and
1937     *         extensions. The accessor "getSubDetailSequence" gives direct access
1938     *         to the value
1939     */
1940    public PositiveIntType getSubDetailSequenceElement() {
1941      if (this.subDetailSequence == null)
1942        if (Configuration.errorOnAutoCreate())
1943          throw new Error("Attempt to auto-create SubDetailComponent.subDetailSequence");
1944        else if (Configuration.doAutoCreate())
1945          this.subDetailSequence = new PositiveIntType(); // bb
1946      return this.subDetailSequence;
1947    }
1948
1949    public boolean hasSubDetailSequenceElement() {
1950      return this.subDetailSequence != null && !this.subDetailSequence.isEmpty();
1951    }
1952
1953    public boolean hasSubDetailSequence() {
1954      return this.subDetailSequence != null && !this.subDetailSequence.isEmpty();
1955    }
1956
1957    /**
1958     * @param value {@link #subDetailSequence} (A number to uniquely reference the
1959     *              claim sub-detail entry.). This is the underlying object with id,
1960     *              value and extensions. The accessor "getSubDetailSequence" gives
1961     *              direct access to the value
1962     */
1963    public SubDetailComponent setSubDetailSequenceElement(PositiveIntType value) {
1964      this.subDetailSequence = value;
1965      return this;
1966    }
1967
1968    /**
1969     * @return A number to uniquely reference the claim sub-detail entry.
1970     */
1971    public int getSubDetailSequence() {
1972      return this.subDetailSequence == null || this.subDetailSequence.isEmpty() ? 0 : this.subDetailSequence.getValue();
1973    }
1974
1975    /**
1976     * @param value A number to uniquely reference the claim sub-detail entry.
1977     */
1978    public SubDetailComponent setSubDetailSequence(int value) {
1979      if (this.subDetailSequence == null)
1980        this.subDetailSequence = new PositiveIntType();
1981      this.subDetailSequence.setValue(value);
1982      return this;
1983    }
1984
1985    /**
1986     * @return {@link #noteNumber} (The numbers associated with notes below which
1987     *         apply to the adjudication of this item.)
1988     */
1989    public List<PositiveIntType> getNoteNumber() {
1990      if (this.noteNumber == null)
1991        this.noteNumber = new ArrayList<PositiveIntType>();
1992      return this.noteNumber;
1993    }
1994
1995    /**
1996     * @return Returns a reference to <code>this</code> for easy method chaining
1997     */
1998    public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
1999      this.noteNumber = theNoteNumber;
2000      return this;
2001    }
2002
2003    public boolean hasNoteNumber() {
2004      if (this.noteNumber == null)
2005        return false;
2006      for (PositiveIntType item : this.noteNumber)
2007        if (!item.isEmpty())
2008          return true;
2009      return false;
2010    }
2011
2012    /**
2013     * @return {@link #noteNumber} (The numbers associated with notes below which
2014     *         apply to the adjudication of this item.)
2015     */
2016    public PositiveIntType addNoteNumberElement() {// 2
2017      PositiveIntType t = new PositiveIntType();
2018      if (this.noteNumber == null)
2019        this.noteNumber = new ArrayList<PositiveIntType>();
2020      this.noteNumber.add(t);
2021      return t;
2022    }
2023
2024    /**
2025     * @param value {@link #noteNumber} (The numbers associated with notes below
2026     *              which apply to the adjudication of this item.)
2027     */
2028    public SubDetailComponent addNoteNumber(int value) { // 1
2029      PositiveIntType t = new PositiveIntType();
2030      t.setValue(value);
2031      if (this.noteNumber == null)
2032        this.noteNumber = new ArrayList<PositiveIntType>();
2033      this.noteNumber.add(t);
2034      return this;
2035    }
2036
2037    /**
2038     * @param value {@link #noteNumber} (The numbers associated with notes below
2039     *              which apply to the adjudication of this item.)
2040     */
2041    public boolean hasNoteNumber(int value) {
2042      if (this.noteNumber == null)
2043        return false;
2044      for (PositiveIntType v : this.noteNumber)
2045        if (v.getValue().equals(value)) // positiveInt
2046          return true;
2047      return false;
2048    }
2049
2050    /**
2051     * @return {@link #adjudication} (The adjudication results.)
2052     */
2053    public List<AdjudicationComponent> getAdjudication() {
2054      if (this.adjudication == null)
2055        this.adjudication = new ArrayList<AdjudicationComponent>();
2056      return this.adjudication;
2057    }
2058
2059    /**
2060     * @return Returns a reference to <code>this</code> for easy method chaining
2061     */
2062    public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
2063      this.adjudication = theAdjudication;
2064      return this;
2065    }
2066
2067    public boolean hasAdjudication() {
2068      if (this.adjudication == null)
2069        return false;
2070      for (AdjudicationComponent item : this.adjudication)
2071        if (!item.isEmpty())
2072          return true;
2073      return false;
2074    }
2075
2076    public AdjudicationComponent addAdjudication() { // 3
2077      AdjudicationComponent t = new AdjudicationComponent();
2078      if (this.adjudication == null)
2079        this.adjudication = new ArrayList<AdjudicationComponent>();
2080      this.adjudication.add(t);
2081      return t;
2082    }
2083
2084    public SubDetailComponent addAdjudication(AdjudicationComponent t) { // 3
2085      if (t == null)
2086        return this;
2087      if (this.adjudication == null)
2088        this.adjudication = new ArrayList<AdjudicationComponent>();
2089      this.adjudication.add(t);
2090      return this;
2091    }
2092
2093    /**
2094     * @return The first repetition of repeating field {@link #adjudication},
2095     *         creating it if it does not already exist
2096     */
2097    public AdjudicationComponent getAdjudicationFirstRep() {
2098      if (getAdjudication().isEmpty()) {
2099        addAdjudication();
2100      }
2101      return getAdjudication().get(0);
2102    }
2103
2104    protected void listChildren(List<Property> children) {
2105      super.listChildren(children);
2106      children.add(new Property("subDetailSequence", "positiveInt",
2107          "A number to uniquely reference the claim sub-detail entry.", 0, 1, subDetailSequence));
2108      children.add(new Property("noteNumber", "positiveInt",
2109          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
2110          java.lang.Integer.MAX_VALUE, noteNumber));
2111      children.add(new Property("adjudication", "@ClaimResponse.item.adjudication", "The adjudication results.", 0,
2112          java.lang.Integer.MAX_VALUE, adjudication));
2113    }
2114
2115    @Override
2116    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
2117      switch (_hash) {
2118      case -855462510:
2119        /* subDetailSequence */ return new Property("subDetailSequence", "positiveInt",
2120            "A number to uniquely reference the claim sub-detail entry.", 0, 1, subDetailSequence);
2121      case -1110033957:
2122        /* noteNumber */ return new Property("noteNumber", "positiveInt",
2123            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
2124            java.lang.Integer.MAX_VALUE, noteNumber);
2125      case -231349275:
2126        /* adjudication */ return new Property("adjudication", "@ClaimResponse.item.adjudication",
2127            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
2128      default:
2129        return super.getNamedProperty(_hash, _name, _checkValid);
2130      }
2131
2132    }
2133
2134    @Override
2135    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2136      switch (hash) {
2137      case -855462510:
2138        /* subDetailSequence */ return this.subDetailSequence == null ? new Base[0]
2139            : new Base[] { this.subDetailSequence }; // PositiveIntType
2140      case -1110033957:
2141        /* noteNumber */ return this.noteNumber == null ? new Base[0]
2142            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
2143      case -231349275:
2144        /* adjudication */ return this.adjudication == null ? new Base[0]
2145            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
2146      default:
2147        return super.getProperty(hash, name, checkValid);
2148      }
2149
2150    }
2151
2152    @Override
2153    public Base setProperty(int hash, String name, Base value) throws FHIRException {
2154      switch (hash) {
2155      case -855462510: // subDetailSequence
2156        this.subDetailSequence = castToPositiveInt(value); // PositiveIntType
2157        return value;
2158      case -1110033957: // noteNumber
2159        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
2160        return value;
2161      case -231349275: // adjudication
2162        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
2163        return value;
2164      default:
2165        return super.setProperty(hash, name, value);
2166      }
2167
2168    }
2169
2170    @Override
2171    public Base setProperty(String name, Base value) throws FHIRException {
2172      if (name.equals("subDetailSequence")) {
2173        this.subDetailSequence = castToPositiveInt(value); // PositiveIntType
2174      } else if (name.equals("noteNumber")) {
2175        this.getNoteNumber().add(castToPositiveInt(value));
2176      } else if (name.equals("adjudication")) {
2177        this.getAdjudication().add((AdjudicationComponent) value);
2178      } else
2179        return super.setProperty(name, value);
2180      return value;
2181    }
2182
2183    @Override
2184    public Base makeProperty(int hash, String name) throws FHIRException {
2185      switch (hash) {
2186      case -855462510:
2187        return getSubDetailSequenceElement();
2188      case -1110033957:
2189        return addNoteNumberElement();
2190      case -231349275:
2191        return addAdjudication();
2192      default:
2193        return super.makeProperty(hash, name);
2194      }
2195
2196    }
2197
2198    @Override
2199    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2200      switch (hash) {
2201      case -855462510:
2202        /* subDetailSequence */ return new String[] { "positiveInt" };
2203      case -1110033957:
2204        /* noteNumber */ return new String[] { "positiveInt" };
2205      case -231349275:
2206        /* adjudication */ return new String[] { "@ClaimResponse.item.adjudication" };
2207      default:
2208        return super.getTypesForProperty(hash, name);
2209      }
2210
2211    }
2212
2213    @Override
2214    public Base addChild(String name) throws FHIRException {
2215      if (name.equals("subDetailSequence")) {
2216        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.subDetailSequence");
2217      } else if (name.equals("noteNumber")) {
2218        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.noteNumber");
2219      } else if (name.equals("adjudication")) {
2220        return addAdjudication();
2221      } else
2222        return super.addChild(name);
2223    }
2224
2225    public SubDetailComponent copy() {
2226      SubDetailComponent dst = new SubDetailComponent();
2227      copyValues(dst);
2228      return dst;
2229    }
2230
2231    public void copyValues(SubDetailComponent dst) {
2232      super.copyValues(dst);
2233      dst.subDetailSequence = subDetailSequence == null ? null : subDetailSequence.copy();
2234      if (noteNumber != null) {
2235        dst.noteNumber = new ArrayList<PositiveIntType>();
2236        for (PositiveIntType i : noteNumber)
2237          dst.noteNumber.add(i.copy());
2238      }
2239      ;
2240      if (adjudication != null) {
2241        dst.adjudication = new ArrayList<AdjudicationComponent>();
2242        for (AdjudicationComponent i : adjudication)
2243          dst.adjudication.add(i.copy());
2244      }
2245      ;
2246    }
2247
2248    @Override
2249    public boolean equalsDeep(Base other_) {
2250      if (!super.equalsDeep(other_))
2251        return false;
2252      if (!(other_ instanceof SubDetailComponent))
2253        return false;
2254      SubDetailComponent o = (SubDetailComponent) other_;
2255      return compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(noteNumber, o.noteNumber, true)
2256          && compareDeep(adjudication, o.adjudication, true);
2257    }
2258
2259    @Override
2260    public boolean equalsShallow(Base other_) {
2261      if (!super.equalsShallow(other_))
2262        return false;
2263      if (!(other_ instanceof SubDetailComponent))
2264        return false;
2265      SubDetailComponent o = (SubDetailComponent) other_;
2266      return compareValues(subDetailSequence, o.subDetailSequence, true)
2267          && compareValues(noteNumber, o.noteNumber, true);
2268    }
2269
2270    public boolean isEmpty() {
2271      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(subDetailSequence, noteNumber, adjudication);
2272    }
2273
2274    public String fhirType() {
2275      return "ClaimResponse.item.detail.subDetail";
2276
2277    }
2278
2279  }
2280
2281  @Block()
2282  public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
2283    /**
2284     * Claim items which this service line is intended to replace.
2285     */
2286    @Child(name = "itemSequence", type = {
2287        PositiveIntType.class }, order = 1, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2288    @Description(shortDefinition = "Item sequence number", formalDefinition = "Claim items which this service line is intended to replace.")
2289    protected List<PositiveIntType> itemSequence;
2290
2291    /**
2292     * The sequence number of the details within the claim item which this line is
2293     * intended to replace.
2294     */
2295    @Child(name = "detailSequence", type = {
2296        PositiveIntType.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2297    @Description(shortDefinition = "Detail sequence number", formalDefinition = "The sequence number of the details within the claim item which this line is intended to replace.")
2298    protected List<PositiveIntType> detailSequence;
2299
2300    /**
2301     * The sequence number of the sub-details within the details within the claim
2302     * item which this line is intended to replace.
2303     */
2304    @Child(name = "subdetailSequence", type = {
2305        PositiveIntType.class }, order = 3, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2306    @Description(shortDefinition = "Subdetail sequence number", formalDefinition = "The sequence number of the sub-details within the details within the claim item which this line is intended to replace.")
2307    protected List<PositiveIntType> subdetailSequence;
2308
2309    /**
2310     * The providers who are authorized for the services rendered to the patient.
2311     */
2312    @Child(name = "provider", type = { Practitioner.class, PractitionerRole.class,
2313        Organization.class }, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2314    @Description(shortDefinition = "Authorized providers", formalDefinition = "The providers who are authorized for the services rendered to the patient.")
2315    protected List<Reference> provider;
2316    /**
2317     * The actual objects that are the target of the reference (The providers who
2318     * are authorized for the services rendered to the patient.)
2319     */
2320    protected List<Resource> providerTarget;
2321
2322    /**
2323     * When the value is a group code then this item collects a set of related claim
2324     * details, otherwise this contains the product, service, drug or other billing
2325     * code for the item.
2326     */
2327    @Child(name = "productOrService", type = {
2328        CodeableConcept.class }, order = 5, min = 1, max = 1, modifier = false, summary = false)
2329    @Description(shortDefinition = "Billing, service, product, or drug code", formalDefinition = "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.")
2330    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
2331    protected CodeableConcept productOrService;
2332
2333    /**
2334     * Item typification or modifiers codes to convey additional context for the
2335     * product or service.
2336     */
2337    @Child(name = "modifier", type = {
2338        CodeableConcept.class }, order = 6, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2339    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
2340    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
2341    protected List<CodeableConcept> modifier;
2342
2343    /**
2344     * Identifies the program under which this may be recovered.
2345     */
2346    @Child(name = "programCode", type = {
2347        CodeableConcept.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2348    @Description(shortDefinition = "Program the product or service is provided under", formalDefinition = "Identifies the program under which this may be recovered.")
2349    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-program-code")
2350    protected List<CodeableConcept> programCode;
2351
2352    /**
2353     * The date or dates when the service or product was supplied, performed or
2354     * completed.
2355     */
2356    @Child(name = "serviced", type = { DateType.class,
2357        Period.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
2358    @Description(shortDefinition = "Date or dates of service or product delivery", formalDefinition = "The date or dates when the service or product was supplied, performed or completed.")
2359    protected Type serviced;
2360
2361    /**
2362     * Where the product or service was provided.
2363     */
2364    @Child(name = "location", type = { CodeableConcept.class, Address.class,
2365        Location.class }, order = 9, min = 0, max = 1, modifier = false, summary = false)
2366    @Description(shortDefinition = "Place of service or where product was supplied", formalDefinition = "Where the product or service was provided.")
2367    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-place")
2368    protected Type location;
2369
2370    /**
2371     * The number of repetitions of a service or product.
2372     */
2373    @Child(name = "quantity", type = {
2374        Quantity.class }, order = 10, min = 0, max = 1, modifier = false, summary = false)
2375    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
2376    protected Quantity quantity;
2377
2378    /**
2379     * If the item is not a group then this is the fee for the product or service,
2380     * otherwise this is the total of the fees for the details of the group.
2381     */
2382    @Child(name = "unitPrice", type = { Money.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
2383    @Description(shortDefinition = "Fee, charge or cost per item", formalDefinition = "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.")
2384    protected Money unitPrice;
2385
2386    /**
2387     * A real number that represents a multiplier used in determining the overall
2388     * value of services delivered and/or goods received. The concept of a Factor
2389     * allows for a discount or surcharge multiplier to be applied to a monetary
2390     * amount.
2391     */
2392    @Child(name = "factor", type = {
2393        DecimalType.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
2394    @Description(shortDefinition = "Price scaling factor", formalDefinition = "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.")
2395    protected DecimalType factor;
2396
2397    /**
2398     * The quantity times the unit price for an additional service or product or
2399     * charge.
2400     */
2401    @Child(name = "net", type = { Money.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
2402    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
2403    protected Money net;
2404
2405    /**
2406     * Physical service site on the patient (limb, tooth, etc.).
2407     */
2408    @Child(name = "bodySite", type = {
2409        CodeableConcept.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
2410    @Description(shortDefinition = "Anatomical location", formalDefinition = "Physical service site on the patient (limb, tooth, etc.).")
2411    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/tooth")
2412    protected CodeableConcept bodySite;
2413
2414    /**
2415     * A region or surface of the bodySite, e.g. limb region or tooth surface(s).
2416     */
2417    @Child(name = "subSite", type = {
2418        CodeableConcept.class }, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2419    @Description(shortDefinition = "Anatomical sub-location", formalDefinition = "A region or surface of the bodySite, e.g. limb region or tooth surface(s).")
2420    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/surface")
2421    protected List<CodeableConcept> subSite;
2422
2423    /**
2424     * The numbers associated with notes below which apply to the adjudication of
2425     * this item.
2426     */
2427    @Child(name = "noteNumber", type = {
2428        PositiveIntType.class }, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2429    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
2430    protected List<PositiveIntType> noteNumber;
2431
2432    /**
2433     * The adjudication results.
2434     */
2435    @Child(name = "adjudication", type = {
2436        AdjudicationComponent.class }, order = 17, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2437    @Description(shortDefinition = "Added items adjudication", formalDefinition = "The adjudication results.")
2438    protected List<AdjudicationComponent> adjudication;
2439
2440    /**
2441     * The second-tier service adjudications for payor added services.
2442     */
2443    @Child(name = "detail", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
2444    @Description(shortDefinition = "Insurer added line details", formalDefinition = "The second-tier service adjudications for payor added services.")
2445    protected List<AddedItemDetailComponent> detail;
2446
2447    private static final long serialVersionUID = -1193747282L;
2448
2449    /**
2450     * Constructor
2451     */
2452    public AddedItemComponent() {
2453      super();
2454    }
2455
2456    /**
2457     * Constructor
2458     */
2459    public AddedItemComponent(CodeableConcept productOrService) {
2460      super();
2461      this.productOrService = productOrService;
2462    }
2463
2464    /**
2465     * @return {@link #itemSequence} (Claim items which this service line is
2466     *         intended to replace.)
2467     */
2468    public List<PositiveIntType> getItemSequence() {
2469      if (this.itemSequence == null)
2470        this.itemSequence = new ArrayList<PositiveIntType>();
2471      return this.itemSequence;
2472    }
2473
2474    /**
2475     * @return Returns a reference to <code>this</code> for easy method chaining
2476     */
2477    public AddedItemComponent setItemSequence(List<PositiveIntType> theItemSequence) {
2478      this.itemSequence = theItemSequence;
2479      return this;
2480    }
2481
2482    public boolean hasItemSequence() {
2483      if (this.itemSequence == null)
2484        return false;
2485      for (PositiveIntType item : this.itemSequence)
2486        if (!item.isEmpty())
2487          return true;
2488      return false;
2489    }
2490
2491    /**
2492     * @return {@link #itemSequence} (Claim items which this service line is
2493     *         intended to replace.)
2494     */
2495    public PositiveIntType addItemSequenceElement() {// 2
2496      PositiveIntType t = new PositiveIntType();
2497      if (this.itemSequence == null)
2498        this.itemSequence = new ArrayList<PositiveIntType>();
2499      this.itemSequence.add(t);
2500      return t;
2501    }
2502
2503    /**
2504     * @param value {@link #itemSequence} (Claim items which this service line is
2505     *              intended to replace.)
2506     */
2507    public AddedItemComponent addItemSequence(int value) { // 1
2508      PositiveIntType t = new PositiveIntType();
2509      t.setValue(value);
2510      if (this.itemSequence == null)
2511        this.itemSequence = new ArrayList<PositiveIntType>();
2512      this.itemSequence.add(t);
2513      return this;
2514    }
2515
2516    /**
2517     * @param value {@link #itemSequence} (Claim items which this service line is
2518     *              intended to replace.)
2519     */
2520    public boolean hasItemSequence(int value) {
2521      if (this.itemSequence == null)
2522        return false;
2523      for (PositiveIntType v : this.itemSequence)
2524        if (v.getValue().equals(value)) // positiveInt
2525          return true;
2526      return false;
2527    }
2528
2529    /**
2530     * @return {@link #detailSequence} (The sequence number of the details within
2531     *         the claim item which this line is intended to replace.)
2532     */
2533    public List<PositiveIntType> getDetailSequence() {
2534      if (this.detailSequence == null)
2535        this.detailSequence = new ArrayList<PositiveIntType>();
2536      return this.detailSequence;
2537    }
2538
2539    /**
2540     * @return Returns a reference to <code>this</code> for easy method chaining
2541     */
2542    public AddedItemComponent setDetailSequence(List<PositiveIntType> theDetailSequence) {
2543      this.detailSequence = theDetailSequence;
2544      return this;
2545    }
2546
2547    public boolean hasDetailSequence() {
2548      if (this.detailSequence == null)
2549        return false;
2550      for (PositiveIntType item : this.detailSequence)
2551        if (!item.isEmpty())
2552          return true;
2553      return false;
2554    }
2555
2556    /**
2557     * @return {@link #detailSequence} (The sequence number of the details within
2558     *         the claim item which this line is intended to replace.)
2559     */
2560    public PositiveIntType addDetailSequenceElement() {// 2
2561      PositiveIntType t = new PositiveIntType();
2562      if (this.detailSequence == null)
2563        this.detailSequence = new ArrayList<PositiveIntType>();
2564      this.detailSequence.add(t);
2565      return t;
2566    }
2567
2568    /**
2569     * @param value {@link #detailSequence} (The sequence number of the details
2570     *              within the claim item which this line is intended to replace.)
2571     */
2572    public AddedItemComponent addDetailSequence(int value) { // 1
2573      PositiveIntType t = new PositiveIntType();
2574      t.setValue(value);
2575      if (this.detailSequence == null)
2576        this.detailSequence = new ArrayList<PositiveIntType>();
2577      this.detailSequence.add(t);
2578      return this;
2579    }
2580
2581    /**
2582     * @param value {@link #detailSequence} (The sequence number of the details
2583     *              within the claim item which this line is intended to replace.)
2584     */
2585    public boolean hasDetailSequence(int value) {
2586      if (this.detailSequence == null)
2587        return false;
2588      for (PositiveIntType v : this.detailSequence)
2589        if (v.getValue().equals(value)) // positiveInt
2590          return true;
2591      return false;
2592    }
2593
2594    /**
2595     * @return {@link #subdetailSequence} (The sequence number of the sub-details
2596     *         within the details within the claim item which this line is intended
2597     *         to replace.)
2598     */
2599    public List<PositiveIntType> getSubdetailSequence() {
2600      if (this.subdetailSequence == null)
2601        this.subdetailSequence = new ArrayList<PositiveIntType>();
2602      return this.subdetailSequence;
2603    }
2604
2605    /**
2606     * @return Returns a reference to <code>this</code> for easy method chaining
2607     */
2608    public AddedItemComponent setSubdetailSequence(List<PositiveIntType> theSubdetailSequence) {
2609      this.subdetailSequence = theSubdetailSequence;
2610      return this;
2611    }
2612
2613    public boolean hasSubdetailSequence() {
2614      if (this.subdetailSequence == null)
2615        return false;
2616      for (PositiveIntType item : this.subdetailSequence)
2617        if (!item.isEmpty())
2618          return true;
2619      return false;
2620    }
2621
2622    /**
2623     * @return {@link #subdetailSequence} (The sequence number of the sub-details
2624     *         within the details within the claim item which this line is intended
2625     *         to replace.)
2626     */
2627    public PositiveIntType addSubdetailSequenceElement() {// 2
2628      PositiveIntType t = new PositiveIntType();
2629      if (this.subdetailSequence == null)
2630        this.subdetailSequence = new ArrayList<PositiveIntType>();
2631      this.subdetailSequence.add(t);
2632      return t;
2633    }
2634
2635    /**
2636     * @param value {@link #subdetailSequence} (The sequence number of the
2637     *              sub-details within the details within the claim item which this
2638     *              line is intended to replace.)
2639     */
2640    public AddedItemComponent addSubdetailSequence(int value) { // 1
2641      PositiveIntType t = new PositiveIntType();
2642      t.setValue(value);
2643      if (this.subdetailSequence == null)
2644        this.subdetailSequence = new ArrayList<PositiveIntType>();
2645      this.subdetailSequence.add(t);
2646      return this;
2647    }
2648
2649    /**
2650     * @param value {@link #subdetailSequence} (The sequence number of the
2651     *              sub-details within the details within the claim item which this
2652     *              line is intended to replace.)
2653     */
2654    public boolean hasSubdetailSequence(int value) {
2655      if (this.subdetailSequence == null)
2656        return false;
2657      for (PositiveIntType v : this.subdetailSequence)
2658        if (v.getValue().equals(value)) // positiveInt
2659          return true;
2660      return false;
2661    }
2662
2663    /**
2664     * @return {@link #provider} (The providers who are authorized for the services
2665     *         rendered to the patient.)
2666     */
2667    public List<Reference> getProvider() {
2668      if (this.provider == null)
2669        this.provider = new ArrayList<Reference>();
2670      return this.provider;
2671    }
2672
2673    /**
2674     * @return Returns a reference to <code>this</code> for easy method chaining
2675     */
2676    public AddedItemComponent setProvider(List<Reference> theProvider) {
2677      this.provider = theProvider;
2678      return this;
2679    }
2680
2681    public boolean hasProvider() {
2682      if (this.provider == null)
2683        return false;
2684      for (Reference item : this.provider)
2685        if (!item.isEmpty())
2686          return true;
2687      return false;
2688    }
2689
2690    public Reference addProvider() { // 3
2691      Reference t = new Reference();
2692      if (this.provider == null)
2693        this.provider = new ArrayList<Reference>();
2694      this.provider.add(t);
2695      return t;
2696    }
2697
2698    public AddedItemComponent addProvider(Reference t) { // 3
2699      if (t == null)
2700        return this;
2701      if (this.provider == null)
2702        this.provider = new ArrayList<Reference>();
2703      this.provider.add(t);
2704      return this;
2705    }
2706
2707    /**
2708     * @return The first repetition of repeating field {@link #provider}, creating
2709     *         it if it does not already exist
2710     */
2711    public Reference getProviderFirstRep() {
2712      if (getProvider().isEmpty()) {
2713        addProvider();
2714      }
2715      return getProvider().get(0);
2716    }
2717
2718    /**
2719     * @deprecated Use Reference#setResource(IBaseResource) instead
2720     */
2721    @Deprecated
2722    public List<Resource> getProviderTarget() {
2723      if (this.providerTarget == null)
2724        this.providerTarget = new ArrayList<Resource>();
2725      return this.providerTarget;
2726    }
2727
2728    /**
2729     * @return {@link #productOrService} (When the value is a group code then this
2730     *         item collects a set of related claim details, otherwise this contains
2731     *         the product, service, drug or other billing code for the item.)
2732     */
2733    public CodeableConcept getProductOrService() {
2734      if (this.productOrService == null)
2735        if (Configuration.errorOnAutoCreate())
2736          throw new Error("Attempt to auto-create AddedItemComponent.productOrService");
2737        else if (Configuration.doAutoCreate())
2738          this.productOrService = new CodeableConcept(); // cc
2739      return this.productOrService;
2740    }
2741
2742    public boolean hasProductOrService() {
2743      return this.productOrService != null && !this.productOrService.isEmpty();
2744    }
2745
2746    /**
2747     * @param value {@link #productOrService} (When the value is a group code then
2748     *              this item collects a set of related claim details, otherwise
2749     *              this contains the product, service, drug or other billing code
2750     *              for the item.)
2751     */
2752    public AddedItemComponent setProductOrService(CodeableConcept value) {
2753      this.productOrService = value;
2754      return this;
2755    }
2756
2757    /**
2758     * @return {@link #modifier} (Item typification or modifiers codes to convey
2759     *         additional context for the product or service.)
2760     */
2761    public List<CodeableConcept> getModifier() {
2762      if (this.modifier == null)
2763        this.modifier = new ArrayList<CodeableConcept>();
2764      return this.modifier;
2765    }
2766
2767    /**
2768     * @return Returns a reference to <code>this</code> for easy method chaining
2769     */
2770    public AddedItemComponent setModifier(List<CodeableConcept> theModifier) {
2771      this.modifier = theModifier;
2772      return this;
2773    }
2774
2775    public boolean hasModifier() {
2776      if (this.modifier == null)
2777        return false;
2778      for (CodeableConcept item : this.modifier)
2779        if (!item.isEmpty())
2780          return true;
2781      return false;
2782    }
2783
2784    public CodeableConcept addModifier() { // 3
2785      CodeableConcept t = new CodeableConcept();
2786      if (this.modifier == null)
2787        this.modifier = new ArrayList<CodeableConcept>();
2788      this.modifier.add(t);
2789      return t;
2790    }
2791
2792    public AddedItemComponent addModifier(CodeableConcept t) { // 3
2793      if (t == null)
2794        return this;
2795      if (this.modifier == null)
2796        this.modifier = new ArrayList<CodeableConcept>();
2797      this.modifier.add(t);
2798      return this;
2799    }
2800
2801    /**
2802     * @return The first repetition of repeating field {@link #modifier}, creating
2803     *         it if it does not already exist
2804     */
2805    public CodeableConcept getModifierFirstRep() {
2806      if (getModifier().isEmpty()) {
2807        addModifier();
2808      }
2809      return getModifier().get(0);
2810    }
2811
2812    /**
2813     * @return {@link #programCode} (Identifies the program under which this may be
2814     *         recovered.)
2815     */
2816    public List<CodeableConcept> getProgramCode() {
2817      if (this.programCode == null)
2818        this.programCode = new ArrayList<CodeableConcept>();
2819      return this.programCode;
2820    }
2821
2822    /**
2823     * @return Returns a reference to <code>this</code> for easy method chaining
2824     */
2825    public AddedItemComponent setProgramCode(List<CodeableConcept> theProgramCode) {
2826      this.programCode = theProgramCode;
2827      return this;
2828    }
2829
2830    public boolean hasProgramCode() {
2831      if (this.programCode == null)
2832        return false;
2833      for (CodeableConcept item : this.programCode)
2834        if (!item.isEmpty())
2835          return true;
2836      return false;
2837    }
2838
2839    public CodeableConcept addProgramCode() { // 3
2840      CodeableConcept t = new CodeableConcept();
2841      if (this.programCode == null)
2842        this.programCode = new ArrayList<CodeableConcept>();
2843      this.programCode.add(t);
2844      return t;
2845    }
2846
2847    public AddedItemComponent addProgramCode(CodeableConcept t) { // 3
2848      if (t == null)
2849        return this;
2850      if (this.programCode == null)
2851        this.programCode = new ArrayList<CodeableConcept>();
2852      this.programCode.add(t);
2853      return this;
2854    }
2855
2856    /**
2857     * @return The first repetition of repeating field {@link #programCode},
2858     *         creating it if it does not already exist
2859     */
2860    public CodeableConcept getProgramCodeFirstRep() {
2861      if (getProgramCode().isEmpty()) {
2862        addProgramCode();
2863      }
2864      return getProgramCode().get(0);
2865    }
2866
2867    /**
2868     * @return {@link #serviced} (The date or dates when the service or product was
2869     *         supplied, performed or completed.)
2870     */
2871    public Type getServiced() {
2872      return this.serviced;
2873    }
2874
2875    /**
2876     * @return {@link #serviced} (The date or dates when the service or product was
2877     *         supplied, performed or completed.)
2878     */
2879    public DateType getServicedDateType() throws FHIRException {
2880      if (this.serviced == null)
2881        this.serviced = new DateType();
2882      if (!(this.serviced instanceof DateType))
2883        throw new FHIRException("Type mismatch: the type DateType was expected, but "
2884            + this.serviced.getClass().getName() + " was encountered");
2885      return (DateType) this.serviced;
2886    }
2887
2888    public boolean hasServicedDateType() {
2889      return this != null && this.serviced instanceof DateType;
2890    }
2891
2892    /**
2893     * @return {@link #serviced} (The date or dates when the service or product was
2894     *         supplied, performed or completed.)
2895     */
2896    public Period getServicedPeriod() throws FHIRException {
2897      if (this.serviced == null)
2898        this.serviced = new Period();
2899      if (!(this.serviced instanceof Period))
2900        throw new FHIRException("Type mismatch: the type Period was expected, but " + this.serviced.getClass().getName()
2901            + " was encountered");
2902      return (Period) this.serviced;
2903    }
2904
2905    public boolean hasServicedPeriod() {
2906      return this != null && this.serviced instanceof Period;
2907    }
2908
2909    public boolean hasServiced() {
2910      return this.serviced != null && !this.serviced.isEmpty();
2911    }
2912
2913    /**
2914     * @param value {@link #serviced} (The date or dates when the service or product
2915     *              was supplied, performed or completed.)
2916     */
2917    public AddedItemComponent setServiced(Type value) {
2918      if (value != null && !(value instanceof DateType || value instanceof Period))
2919        throw new Error("Not the right type for ClaimResponse.addItem.serviced[x]: " + value.fhirType());
2920      this.serviced = value;
2921      return this;
2922    }
2923
2924    /**
2925     * @return {@link #location} (Where the product or service was provided.)
2926     */
2927    public Type getLocation() {
2928      return this.location;
2929    }
2930
2931    /**
2932     * @return {@link #location} (Where the product or service was provided.)
2933     */
2934    public CodeableConcept getLocationCodeableConcept() throws FHIRException {
2935      if (this.location == null)
2936        this.location = new CodeableConcept();
2937      if (!(this.location instanceof CodeableConcept))
2938        throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "
2939            + this.location.getClass().getName() + " was encountered");
2940      return (CodeableConcept) this.location;
2941    }
2942
2943    public boolean hasLocationCodeableConcept() {
2944      return this != null && this.location instanceof CodeableConcept;
2945    }
2946
2947    /**
2948     * @return {@link #location} (Where the product or service was provided.)
2949     */
2950    public Address getLocationAddress() throws FHIRException {
2951      if (this.location == null)
2952        this.location = new Address();
2953      if (!(this.location instanceof Address))
2954        throw new FHIRException("Type mismatch: the type Address was expected, but "
2955            + this.location.getClass().getName() + " was encountered");
2956      return (Address) this.location;
2957    }
2958
2959    public boolean hasLocationAddress() {
2960      return this != null && this.location instanceof Address;
2961    }
2962
2963    /**
2964     * @return {@link #location} (Where the product or service was provided.)
2965     */
2966    public Reference getLocationReference() throws FHIRException {
2967      if (this.location == null)
2968        this.location = new Reference();
2969      if (!(this.location instanceof Reference))
2970        throw new FHIRException("Type mismatch: the type Reference was expected, but "
2971            + this.location.getClass().getName() + " was encountered");
2972      return (Reference) this.location;
2973    }
2974
2975    public boolean hasLocationReference() {
2976      return this != null && this.location instanceof Reference;
2977    }
2978
2979    public boolean hasLocation() {
2980      return this.location != null && !this.location.isEmpty();
2981    }
2982
2983    /**
2984     * @param value {@link #location} (Where the product or service was provided.)
2985     */
2986    public AddedItemComponent setLocation(Type value) {
2987      if (value != null
2988          && !(value instanceof CodeableConcept || value instanceof Address || value instanceof Reference))
2989        throw new Error("Not the right type for ClaimResponse.addItem.location[x]: " + value.fhirType());
2990      this.location = value;
2991      return this;
2992    }
2993
2994    /**
2995     * @return {@link #quantity} (The number of repetitions of a service or
2996     *         product.)
2997     */
2998    public Quantity getQuantity() {
2999      if (this.quantity == null)
3000        if (Configuration.errorOnAutoCreate())
3001          throw new Error("Attempt to auto-create AddedItemComponent.quantity");
3002        else if (Configuration.doAutoCreate())
3003          this.quantity = new Quantity(); // cc
3004      return this.quantity;
3005    }
3006
3007    public boolean hasQuantity() {
3008      return this.quantity != null && !this.quantity.isEmpty();
3009    }
3010
3011    /**
3012     * @param value {@link #quantity} (The number of repetitions of a service or
3013     *              product.)
3014     */
3015    public AddedItemComponent setQuantity(Quantity value) {
3016      this.quantity = value;
3017      return this;
3018    }
3019
3020    /**
3021     * @return {@link #unitPrice} (If the item is not a group then this is the fee
3022     *         for the product or service, otherwise this is the total of the fees
3023     *         for the details of the group.)
3024     */
3025    public Money getUnitPrice() {
3026      if (this.unitPrice == null)
3027        if (Configuration.errorOnAutoCreate())
3028          throw new Error("Attempt to auto-create AddedItemComponent.unitPrice");
3029        else if (Configuration.doAutoCreate())
3030          this.unitPrice = new Money(); // cc
3031      return this.unitPrice;
3032    }
3033
3034    public boolean hasUnitPrice() {
3035      return this.unitPrice != null && !this.unitPrice.isEmpty();
3036    }
3037
3038    /**
3039     * @param value {@link #unitPrice} (If the item is not a group then this is the
3040     *              fee for the product or service, otherwise this is the total of
3041     *              the fees for the details of the group.)
3042     */
3043    public AddedItemComponent setUnitPrice(Money value) {
3044      this.unitPrice = value;
3045      return this;
3046    }
3047
3048    /**
3049     * @return {@link #factor} (A real number that represents a multiplier used in
3050     *         determining the overall value of services delivered and/or goods
3051     *         received. The concept of a Factor allows for a discount or surcharge
3052     *         multiplier to be applied to a monetary amount.). This is the
3053     *         underlying object with id, value and extensions. The accessor
3054     *         "getFactor" gives direct access to the value
3055     */
3056    public DecimalType getFactorElement() {
3057      if (this.factor == null)
3058        if (Configuration.errorOnAutoCreate())
3059          throw new Error("Attempt to auto-create AddedItemComponent.factor");
3060        else if (Configuration.doAutoCreate())
3061          this.factor = new DecimalType(); // bb
3062      return this.factor;
3063    }
3064
3065    public boolean hasFactorElement() {
3066      return this.factor != null && !this.factor.isEmpty();
3067    }
3068
3069    public boolean hasFactor() {
3070      return this.factor != null && !this.factor.isEmpty();
3071    }
3072
3073    /**
3074     * @param value {@link #factor} (A real number that represents a multiplier used
3075     *              in determining the overall value of services delivered and/or
3076     *              goods received. The concept of a Factor allows for a discount or
3077     *              surcharge multiplier to be applied to a monetary amount.). This
3078     *              is the underlying object with id, value and extensions. The
3079     *              accessor "getFactor" gives direct access to the value
3080     */
3081    public AddedItemComponent setFactorElement(DecimalType value) {
3082      this.factor = value;
3083      return this;
3084    }
3085
3086    /**
3087     * @return A real number that represents a multiplier used in determining the
3088     *         overall value of services delivered and/or goods received. The
3089     *         concept of a Factor allows for a discount or surcharge multiplier to
3090     *         be applied to a monetary amount.
3091     */
3092    public BigDecimal getFactor() {
3093      return this.factor == null ? null : this.factor.getValue();
3094    }
3095
3096    /**
3097     * @param value A real number that represents a multiplier used in determining
3098     *              the overall value of services delivered and/or goods received.
3099     *              The concept of a Factor allows for a discount or surcharge
3100     *              multiplier to be applied to a monetary amount.
3101     */
3102    public AddedItemComponent setFactor(BigDecimal value) {
3103      if (value == null)
3104        this.factor = null;
3105      else {
3106        if (this.factor == null)
3107          this.factor = new DecimalType();
3108        this.factor.setValue(value);
3109      }
3110      return this;
3111    }
3112
3113    /**
3114     * @param value A real number that represents a multiplier used in determining
3115     *              the overall value of services delivered and/or goods received.
3116     *              The concept of a Factor allows for a discount or surcharge
3117     *              multiplier to be applied to a monetary amount.
3118     */
3119    public AddedItemComponent setFactor(long value) {
3120      this.factor = new DecimalType();
3121      this.factor.setValue(value);
3122      return this;
3123    }
3124
3125    /**
3126     * @param value A real number that represents a multiplier used in determining
3127     *              the overall value of services delivered and/or goods received.
3128     *              The concept of a Factor allows for a discount or surcharge
3129     *              multiplier to be applied to a monetary amount.
3130     */
3131    public AddedItemComponent setFactor(double value) {
3132      this.factor = new DecimalType();
3133      this.factor.setValue(value);
3134      return this;
3135    }
3136
3137    /**
3138     * @return {@link #net} (The quantity times the unit price for an additional
3139     *         service or product or charge.)
3140     */
3141    public Money getNet() {
3142      if (this.net == null)
3143        if (Configuration.errorOnAutoCreate())
3144          throw new Error("Attempt to auto-create AddedItemComponent.net");
3145        else if (Configuration.doAutoCreate())
3146          this.net = new Money(); // cc
3147      return this.net;
3148    }
3149
3150    public boolean hasNet() {
3151      return this.net != null && !this.net.isEmpty();
3152    }
3153
3154    /**
3155     * @param value {@link #net} (The quantity times the unit price for an
3156     *              additional service or product or charge.)
3157     */
3158    public AddedItemComponent setNet(Money value) {
3159      this.net = value;
3160      return this;
3161    }
3162
3163    /**
3164     * @return {@link #bodySite} (Physical service site on the patient (limb, tooth,
3165     *         etc.).)
3166     */
3167    public CodeableConcept getBodySite() {
3168      if (this.bodySite == null)
3169        if (Configuration.errorOnAutoCreate())
3170          throw new Error("Attempt to auto-create AddedItemComponent.bodySite");
3171        else if (Configuration.doAutoCreate())
3172          this.bodySite = new CodeableConcept(); // cc
3173      return this.bodySite;
3174    }
3175
3176    public boolean hasBodySite() {
3177      return this.bodySite != null && !this.bodySite.isEmpty();
3178    }
3179
3180    /**
3181     * @param value {@link #bodySite} (Physical service site on the patient (limb,
3182     *              tooth, etc.).)
3183     */
3184    public AddedItemComponent setBodySite(CodeableConcept value) {
3185      this.bodySite = value;
3186      return this;
3187    }
3188
3189    /**
3190     * @return {@link #subSite} (A region or surface of the bodySite, e.g. limb
3191     *         region or tooth surface(s).)
3192     */
3193    public List<CodeableConcept> getSubSite() {
3194      if (this.subSite == null)
3195        this.subSite = new ArrayList<CodeableConcept>();
3196      return this.subSite;
3197    }
3198
3199    /**
3200     * @return Returns a reference to <code>this</code> for easy method chaining
3201     */
3202    public AddedItemComponent setSubSite(List<CodeableConcept> theSubSite) {
3203      this.subSite = theSubSite;
3204      return this;
3205    }
3206
3207    public boolean hasSubSite() {
3208      if (this.subSite == null)
3209        return false;
3210      for (CodeableConcept item : this.subSite)
3211        if (!item.isEmpty())
3212          return true;
3213      return false;
3214    }
3215
3216    public CodeableConcept addSubSite() { // 3
3217      CodeableConcept t = new CodeableConcept();
3218      if (this.subSite == null)
3219        this.subSite = new ArrayList<CodeableConcept>();
3220      this.subSite.add(t);
3221      return t;
3222    }
3223
3224    public AddedItemComponent addSubSite(CodeableConcept t) { // 3
3225      if (t == null)
3226        return this;
3227      if (this.subSite == null)
3228        this.subSite = new ArrayList<CodeableConcept>();
3229      this.subSite.add(t);
3230      return this;
3231    }
3232
3233    /**
3234     * @return The first repetition of repeating field {@link #subSite}, creating it
3235     *         if it does not already exist
3236     */
3237    public CodeableConcept getSubSiteFirstRep() {
3238      if (getSubSite().isEmpty()) {
3239        addSubSite();
3240      }
3241      return getSubSite().get(0);
3242    }
3243
3244    /**
3245     * @return {@link #noteNumber} (The numbers associated with notes below which
3246     *         apply to the adjudication of this item.)
3247     */
3248    public List<PositiveIntType> getNoteNumber() {
3249      if (this.noteNumber == null)
3250        this.noteNumber = new ArrayList<PositiveIntType>();
3251      return this.noteNumber;
3252    }
3253
3254    /**
3255     * @return Returns a reference to <code>this</code> for easy method chaining
3256     */
3257    public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
3258      this.noteNumber = theNoteNumber;
3259      return this;
3260    }
3261
3262    public boolean hasNoteNumber() {
3263      if (this.noteNumber == null)
3264        return false;
3265      for (PositiveIntType item : this.noteNumber)
3266        if (!item.isEmpty())
3267          return true;
3268      return false;
3269    }
3270
3271    /**
3272     * @return {@link #noteNumber} (The numbers associated with notes below which
3273     *         apply to the adjudication of this item.)
3274     */
3275    public PositiveIntType addNoteNumberElement() {// 2
3276      PositiveIntType t = new PositiveIntType();
3277      if (this.noteNumber == null)
3278        this.noteNumber = new ArrayList<PositiveIntType>();
3279      this.noteNumber.add(t);
3280      return t;
3281    }
3282
3283    /**
3284     * @param value {@link #noteNumber} (The numbers associated with notes below
3285     *              which apply to the adjudication of this item.)
3286     */
3287    public AddedItemComponent addNoteNumber(int value) { // 1
3288      PositiveIntType t = new PositiveIntType();
3289      t.setValue(value);
3290      if (this.noteNumber == null)
3291        this.noteNumber = new ArrayList<PositiveIntType>();
3292      this.noteNumber.add(t);
3293      return this;
3294    }
3295
3296    /**
3297     * @param value {@link #noteNumber} (The numbers associated with notes below
3298     *              which apply to the adjudication of this item.)
3299     */
3300    public boolean hasNoteNumber(int value) {
3301      if (this.noteNumber == null)
3302        return false;
3303      for (PositiveIntType v : this.noteNumber)
3304        if (v.getValue().equals(value)) // positiveInt
3305          return true;
3306      return false;
3307    }
3308
3309    /**
3310     * @return {@link #adjudication} (The adjudication results.)
3311     */
3312    public List<AdjudicationComponent> getAdjudication() {
3313      if (this.adjudication == null)
3314        this.adjudication = new ArrayList<AdjudicationComponent>();
3315      return this.adjudication;
3316    }
3317
3318    /**
3319     * @return Returns a reference to <code>this</code> for easy method chaining
3320     */
3321    public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
3322      this.adjudication = theAdjudication;
3323      return this;
3324    }
3325
3326    public boolean hasAdjudication() {
3327      if (this.adjudication == null)
3328        return false;
3329      for (AdjudicationComponent item : this.adjudication)
3330        if (!item.isEmpty())
3331          return true;
3332      return false;
3333    }
3334
3335    public AdjudicationComponent addAdjudication() { // 3
3336      AdjudicationComponent t = new AdjudicationComponent();
3337      if (this.adjudication == null)
3338        this.adjudication = new ArrayList<AdjudicationComponent>();
3339      this.adjudication.add(t);
3340      return t;
3341    }
3342
3343    public AddedItemComponent addAdjudication(AdjudicationComponent t) { // 3
3344      if (t == null)
3345        return this;
3346      if (this.adjudication == null)
3347        this.adjudication = new ArrayList<AdjudicationComponent>();
3348      this.adjudication.add(t);
3349      return this;
3350    }
3351
3352    /**
3353     * @return The first repetition of repeating field {@link #adjudication},
3354     *         creating it if it does not already exist
3355     */
3356    public AdjudicationComponent getAdjudicationFirstRep() {
3357      if (getAdjudication().isEmpty()) {
3358        addAdjudication();
3359      }
3360      return getAdjudication().get(0);
3361    }
3362
3363    /**
3364     * @return {@link #detail} (The second-tier service adjudications for payor
3365     *         added services.)
3366     */
3367    public List<AddedItemDetailComponent> getDetail() {
3368      if (this.detail == null)
3369        this.detail = new ArrayList<AddedItemDetailComponent>();
3370      return this.detail;
3371    }
3372
3373    /**
3374     * @return Returns a reference to <code>this</code> for easy method chaining
3375     */
3376    public AddedItemComponent setDetail(List<AddedItemDetailComponent> theDetail) {
3377      this.detail = theDetail;
3378      return this;
3379    }
3380
3381    public boolean hasDetail() {
3382      if (this.detail == null)
3383        return false;
3384      for (AddedItemDetailComponent item : this.detail)
3385        if (!item.isEmpty())
3386          return true;
3387      return false;
3388    }
3389
3390    public AddedItemDetailComponent addDetail() { // 3
3391      AddedItemDetailComponent t = new AddedItemDetailComponent();
3392      if (this.detail == null)
3393        this.detail = new ArrayList<AddedItemDetailComponent>();
3394      this.detail.add(t);
3395      return t;
3396    }
3397
3398    public AddedItemComponent addDetail(AddedItemDetailComponent t) { // 3
3399      if (t == null)
3400        return this;
3401      if (this.detail == null)
3402        this.detail = new ArrayList<AddedItemDetailComponent>();
3403      this.detail.add(t);
3404      return this;
3405    }
3406
3407    /**
3408     * @return The first repetition of repeating field {@link #detail}, creating it
3409     *         if it does not already exist
3410     */
3411    public AddedItemDetailComponent getDetailFirstRep() {
3412      if (getDetail().isEmpty()) {
3413        addDetail();
3414      }
3415      return getDetail().get(0);
3416    }
3417
3418    protected void listChildren(List<Property> children) {
3419      super.listChildren(children);
3420      children.add(new Property("itemSequence", "positiveInt",
3421          "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, itemSequence));
3422      children.add(new Property("detailSequence", "positiveInt",
3423          "The sequence number of the details within the claim item which this line is intended to replace.", 0,
3424          java.lang.Integer.MAX_VALUE, detailSequence));
3425      children.add(new Property("subdetailSequence", "positiveInt",
3426          "The sequence number of the sub-details within the details within the claim item which this line is intended to replace.",
3427          0, java.lang.Integer.MAX_VALUE, subdetailSequence));
3428      children.add(new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
3429          "The providers who are authorized for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE,
3430          provider));
3431      children.add(new Property("productOrService", "CodeableConcept",
3432          "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.",
3433          0, 1, productOrService));
3434      children.add(new Property("modifier", "CodeableConcept",
3435          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
3436          java.lang.Integer.MAX_VALUE, modifier));
3437      children.add(new Property("programCode", "CodeableConcept",
3438          "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode));
3439      children.add(new Property("serviced[x]", "date|Period",
3440          "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced));
3441      children.add(new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
3442          "Where the product or service was provided.", 0, 1, location));
3443      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
3444          1, quantity));
3445      children.add(new Property("unitPrice", "Money",
3446          "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.",
3447          0, 1, unitPrice));
3448      children.add(new Property("factor", "decimal",
3449          "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
3450          0, 1, factor));
3451      children.add(new Property("net", "Money",
3452          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
3453      children.add(new Property("bodySite", "CodeableConcept",
3454          "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite));
3455      children.add(new Property("subSite", "CodeableConcept",
3456          "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0, java.lang.Integer.MAX_VALUE,
3457          subSite));
3458      children.add(new Property("noteNumber", "positiveInt",
3459          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
3460          java.lang.Integer.MAX_VALUE, noteNumber));
3461      children.add(new Property("adjudication", "@ClaimResponse.item.adjudication", "The adjudication results.", 0,
3462          java.lang.Integer.MAX_VALUE, adjudication));
3463      children.add(new Property("detail", "", "The second-tier service adjudications for payor added services.", 0,
3464          java.lang.Integer.MAX_VALUE, detail));
3465    }
3466
3467    @Override
3468    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
3469      switch (_hash) {
3470      case 1977979892:
3471        /* itemSequence */ return new Property("itemSequence", "positiveInt",
3472            "Claim items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE,
3473            itemSequence);
3474      case 1321472818:
3475        /* detailSequence */ return new Property("detailSequence", "positiveInt",
3476            "The sequence number of the details within the claim item which this line is intended to replace.", 0,
3477            java.lang.Integer.MAX_VALUE, detailSequence);
3478      case 146530674:
3479        /* subdetailSequence */ return new Property("subdetailSequence", "positiveInt",
3480            "The sequence number of the sub-details within the details within the claim item which this line is intended to replace.",
3481            0, java.lang.Integer.MAX_VALUE, subdetailSequence);
3482      case -987494927:
3483        /* provider */ return new Property("provider", "Reference(Practitioner|PractitionerRole|Organization)",
3484            "The providers who are authorized for the services rendered to the patient.", 0,
3485            java.lang.Integer.MAX_VALUE, provider);
3486      case 1957227299:
3487        /* productOrService */ return new Property("productOrService", "CodeableConcept",
3488            "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.",
3489            0, 1, productOrService);
3490      case -615513385:
3491        /* modifier */ return new Property("modifier", "CodeableConcept",
3492            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
3493            java.lang.Integer.MAX_VALUE, modifier);
3494      case 1010065041:
3495        /* programCode */ return new Property("programCode", "CodeableConcept",
3496            "Identifies the program under which this may be recovered.", 0, java.lang.Integer.MAX_VALUE, programCode);
3497      case -1927922223:
3498        /* serviced[x] */ return new Property("serviced[x]", "date|Period",
3499            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
3500      case 1379209295:
3501        /* serviced */ return new Property("serviced[x]", "date|Period",
3502            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
3503      case 363246749:
3504        /* servicedDate */ return new Property("serviced[x]", "date|Period",
3505            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
3506      case 1534966512:
3507        /* servicedPeriod */ return new Property("serviced[x]", "date|Period",
3508            "The date or dates when the service or product was supplied, performed or completed.", 0, 1, serviced);
3509      case 552316075:
3510        /* location[x] */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
3511            "Where the product or service was provided.", 0, 1, location);
3512      case 1901043637:
3513        /* location */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
3514            "Where the product or service was provided.", 0, 1, location);
3515      case -1224800468:
3516        /* locationCodeableConcept */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
3517            "Where the product or service was provided.", 0, 1, location);
3518      case -1280020865:
3519        /* locationAddress */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
3520            "Where the product or service was provided.", 0, 1, location);
3521      case 755866390:
3522        /* locationReference */ return new Property("location[x]", "CodeableConcept|Address|Reference(Location)",
3523            "Where the product or service was provided.", 0, 1, location);
3524      case -1285004149:
3525        /* quantity */ return new Property("quantity", "SimpleQuantity",
3526            "The number of repetitions of a service or product.", 0, 1, quantity);
3527      case -486196699:
3528        /* unitPrice */ return new Property("unitPrice", "Money",
3529            "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.",
3530            0, 1, unitPrice);
3531      case -1282148017:
3532        /* factor */ return new Property("factor", "decimal",
3533            "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
3534            0, 1, factor);
3535      case 108957:
3536        /* net */ return new Property("net", "Money",
3537            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
3538      case 1702620169:
3539        /* bodySite */ return new Property("bodySite", "CodeableConcept",
3540            "Physical service site on the patient (limb, tooth, etc.).", 0, 1, bodySite);
3541      case -1868566105:
3542        /* subSite */ return new Property("subSite", "CodeableConcept",
3543            "A region or surface of the bodySite, e.g. limb region or tooth surface(s).", 0,
3544            java.lang.Integer.MAX_VALUE, subSite);
3545      case -1110033957:
3546        /* noteNumber */ return new Property("noteNumber", "positiveInt",
3547            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
3548            java.lang.Integer.MAX_VALUE, noteNumber);
3549      case -231349275:
3550        /* adjudication */ return new Property("adjudication", "@ClaimResponse.item.adjudication",
3551            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
3552      case -1335224239:
3553        /* detail */ return new Property("detail", "",
3554            "The second-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail);
3555      default:
3556        return super.getNamedProperty(_hash, _name, _checkValid);
3557      }
3558
3559    }
3560
3561    @Override
3562    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3563      switch (hash) {
3564      case 1977979892:
3565        /* itemSequence */ return this.itemSequence == null ? new Base[0]
3566            : this.itemSequence.toArray(new Base[this.itemSequence.size()]); // PositiveIntType
3567      case 1321472818:
3568        /* detailSequence */ return this.detailSequence == null ? new Base[0]
3569            : this.detailSequence.toArray(new Base[this.detailSequence.size()]); // PositiveIntType
3570      case 146530674:
3571        /* subdetailSequence */ return this.subdetailSequence == null ? new Base[0]
3572            : this.subdetailSequence.toArray(new Base[this.subdetailSequence.size()]); // PositiveIntType
3573      case -987494927:
3574        /* provider */ return this.provider == null ? new Base[0]
3575            : this.provider.toArray(new Base[this.provider.size()]); // Reference
3576      case 1957227299:
3577        /* productOrService */ return this.productOrService == null ? new Base[0]
3578            : new Base[] { this.productOrService }; // CodeableConcept
3579      case -615513385:
3580        /* modifier */ return this.modifier == null ? new Base[0]
3581            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
3582      case 1010065041:
3583        /* programCode */ return this.programCode == null ? new Base[0]
3584            : this.programCode.toArray(new Base[this.programCode.size()]); // CodeableConcept
3585      case 1379209295:
3586        /* serviced */ return this.serviced == null ? new Base[0] : new Base[] { this.serviced }; // Type
3587      case 1901043637:
3588        /* location */ return this.location == null ? new Base[0] : new Base[] { this.location }; // Type
3589      case -1285004149:
3590        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
3591      case -486196699:
3592        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
3593      case -1282148017:
3594        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
3595      case 108957:
3596        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
3597      case 1702620169:
3598        /* bodySite */ return this.bodySite == null ? new Base[0] : new Base[] { this.bodySite }; // CodeableConcept
3599      case -1868566105:
3600        /* subSite */ return this.subSite == null ? new Base[0] : this.subSite.toArray(new Base[this.subSite.size()]); // CodeableConcept
3601      case -1110033957:
3602        /* noteNumber */ return this.noteNumber == null ? new Base[0]
3603            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
3604      case -231349275:
3605        /* adjudication */ return this.adjudication == null ? new Base[0]
3606            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
3607      case -1335224239:
3608        /* detail */ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemDetailComponent
3609      default:
3610        return super.getProperty(hash, name, checkValid);
3611      }
3612
3613    }
3614
3615    @Override
3616    public Base setProperty(int hash, String name, Base value) throws FHIRException {
3617      switch (hash) {
3618      case 1977979892: // itemSequence
3619        this.getItemSequence().add(castToPositiveInt(value)); // PositiveIntType
3620        return value;
3621      case 1321472818: // detailSequence
3622        this.getDetailSequence().add(castToPositiveInt(value)); // PositiveIntType
3623        return value;
3624      case 146530674: // subdetailSequence
3625        this.getSubdetailSequence().add(castToPositiveInt(value)); // PositiveIntType
3626        return value;
3627      case -987494927: // provider
3628        this.getProvider().add(castToReference(value)); // Reference
3629        return value;
3630      case 1957227299: // productOrService
3631        this.productOrService = castToCodeableConcept(value); // CodeableConcept
3632        return value;
3633      case -615513385: // modifier
3634        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
3635        return value;
3636      case 1010065041: // programCode
3637        this.getProgramCode().add(castToCodeableConcept(value)); // CodeableConcept
3638        return value;
3639      case 1379209295: // serviced
3640        this.serviced = castToType(value); // Type
3641        return value;
3642      case 1901043637: // location
3643        this.location = castToType(value); // Type
3644        return value;
3645      case -1285004149: // quantity
3646        this.quantity = castToQuantity(value); // Quantity
3647        return value;
3648      case -486196699: // unitPrice
3649        this.unitPrice = castToMoney(value); // Money
3650        return value;
3651      case -1282148017: // factor
3652        this.factor = castToDecimal(value); // DecimalType
3653        return value;
3654      case 108957: // net
3655        this.net = castToMoney(value); // Money
3656        return value;
3657      case 1702620169: // bodySite
3658        this.bodySite = castToCodeableConcept(value); // CodeableConcept
3659        return value;
3660      case -1868566105: // subSite
3661        this.getSubSite().add(castToCodeableConcept(value)); // CodeableConcept
3662        return value;
3663      case -1110033957: // noteNumber
3664        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
3665        return value;
3666      case -231349275: // adjudication
3667        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
3668        return value;
3669      case -1335224239: // detail
3670        this.getDetail().add((AddedItemDetailComponent) value); // AddedItemDetailComponent
3671        return value;
3672      default:
3673        return super.setProperty(hash, name, value);
3674      }
3675
3676    }
3677
3678    @Override
3679    public Base setProperty(String name, Base value) throws FHIRException {
3680      if (name.equals("itemSequence")) {
3681        this.getItemSequence().add(castToPositiveInt(value));
3682      } else if (name.equals("detailSequence")) {
3683        this.getDetailSequence().add(castToPositiveInt(value));
3684      } else if (name.equals("subdetailSequence")) {
3685        this.getSubdetailSequence().add(castToPositiveInt(value));
3686      } else if (name.equals("provider")) {
3687        this.getProvider().add(castToReference(value));
3688      } else if (name.equals("productOrService")) {
3689        this.productOrService = castToCodeableConcept(value); // CodeableConcept
3690      } else if (name.equals("modifier")) {
3691        this.getModifier().add(castToCodeableConcept(value));
3692      } else if (name.equals("programCode")) {
3693        this.getProgramCode().add(castToCodeableConcept(value));
3694      } else if (name.equals("serviced[x]")) {
3695        this.serviced = castToType(value); // Type
3696      } else if (name.equals("location[x]")) {
3697        this.location = castToType(value); // Type
3698      } else if (name.equals("quantity")) {
3699        this.quantity = castToQuantity(value); // Quantity
3700      } else if (name.equals("unitPrice")) {
3701        this.unitPrice = castToMoney(value); // Money
3702      } else if (name.equals("factor")) {
3703        this.factor = castToDecimal(value); // DecimalType
3704      } else if (name.equals("net")) {
3705        this.net = castToMoney(value); // Money
3706      } else if (name.equals("bodySite")) {
3707        this.bodySite = castToCodeableConcept(value); // CodeableConcept
3708      } else if (name.equals("subSite")) {
3709        this.getSubSite().add(castToCodeableConcept(value));
3710      } else if (name.equals("noteNumber")) {
3711        this.getNoteNumber().add(castToPositiveInt(value));
3712      } else if (name.equals("adjudication")) {
3713        this.getAdjudication().add((AdjudicationComponent) value);
3714      } else if (name.equals("detail")) {
3715        this.getDetail().add((AddedItemDetailComponent) value);
3716      } else
3717        return super.setProperty(name, value);
3718      return value;
3719    }
3720
3721    @Override
3722    public Base makeProperty(int hash, String name) throws FHIRException {
3723      switch (hash) {
3724      case 1977979892:
3725        return addItemSequenceElement();
3726      case 1321472818:
3727        return addDetailSequenceElement();
3728      case 146530674:
3729        return addSubdetailSequenceElement();
3730      case -987494927:
3731        return addProvider();
3732      case 1957227299:
3733        return getProductOrService();
3734      case -615513385:
3735        return addModifier();
3736      case 1010065041:
3737        return addProgramCode();
3738      case -1927922223:
3739        return getServiced();
3740      case 1379209295:
3741        return getServiced();
3742      case 552316075:
3743        return getLocation();
3744      case 1901043637:
3745        return getLocation();
3746      case -1285004149:
3747        return getQuantity();
3748      case -486196699:
3749        return getUnitPrice();
3750      case -1282148017:
3751        return getFactorElement();
3752      case 108957:
3753        return getNet();
3754      case 1702620169:
3755        return getBodySite();
3756      case -1868566105:
3757        return addSubSite();
3758      case -1110033957:
3759        return addNoteNumberElement();
3760      case -231349275:
3761        return addAdjudication();
3762      case -1335224239:
3763        return addDetail();
3764      default:
3765        return super.makeProperty(hash, name);
3766      }
3767
3768    }
3769
3770    @Override
3771    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3772      switch (hash) {
3773      case 1977979892:
3774        /* itemSequence */ return new String[] { "positiveInt" };
3775      case 1321472818:
3776        /* detailSequence */ return new String[] { "positiveInt" };
3777      case 146530674:
3778        /* subdetailSequence */ return new String[] { "positiveInt" };
3779      case -987494927:
3780        /* provider */ return new String[] { "Reference" };
3781      case 1957227299:
3782        /* productOrService */ return new String[] { "CodeableConcept" };
3783      case -615513385:
3784        /* modifier */ return new String[] { "CodeableConcept" };
3785      case 1010065041:
3786        /* programCode */ return new String[] { "CodeableConcept" };
3787      case 1379209295:
3788        /* serviced */ return new String[] { "date", "Period" };
3789      case 1901043637:
3790        /* location */ return new String[] { "CodeableConcept", "Address", "Reference" };
3791      case -1285004149:
3792        /* quantity */ return new String[] { "SimpleQuantity" };
3793      case -486196699:
3794        /* unitPrice */ return new String[] { "Money" };
3795      case -1282148017:
3796        /* factor */ return new String[] { "decimal" };
3797      case 108957:
3798        /* net */ return new String[] { "Money" };
3799      case 1702620169:
3800        /* bodySite */ return new String[] { "CodeableConcept" };
3801      case -1868566105:
3802        /* subSite */ return new String[] { "CodeableConcept" };
3803      case -1110033957:
3804        /* noteNumber */ return new String[] { "positiveInt" };
3805      case -231349275:
3806        /* adjudication */ return new String[] { "@ClaimResponse.item.adjudication" };
3807      case -1335224239:
3808        /* detail */ return new String[] {};
3809      default:
3810        return super.getTypesForProperty(hash, name);
3811      }
3812
3813    }
3814
3815    @Override
3816    public Base addChild(String name) throws FHIRException {
3817      if (name.equals("itemSequence")) {
3818        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.itemSequence");
3819      } else if (name.equals("detailSequence")) {
3820        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.detailSequence");
3821      } else if (name.equals("subdetailSequence")) {
3822        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.subdetailSequence");
3823      } else if (name.equals("provider")) {
3824        return addProvider();
3825      } else if (name.equals("productOrService")) {
3826        this.productOrService = new CodeableConcept();
3827        return this.productOrService;
3828      } else if (name.equals("modifier")) {
3829        return addModifier();
3830      } else if (name.equals("programCode")) {
3831        return addProgramCode();
3832      } else if (name.equals("servicedDate")) {
3833        this.serviced = new DateType();
3834        return this.serviced;
3835      } else if (name.equals("servicedPeriod")) {
3836        this.serviced = new Period();
3837        return this.serviced;
3838      } else if (name.equals("locationCodeableConcept")) {
3839        this.location = new CodeableConcept();
3840        return this.location;
3841      } else if (name.equals("locationAddress")) {
3842        this.location = new Address();
3843        return this.location;
3844      } else if (name.equals("locationReference")) {
3845        this.location = new Reference();
3846        return this.location;
3847      } else if (name.equals("quantity")) {
3848        this.quantity = new Quantity();
3849        return this.quantity;
3850      } else if (name.equals("unitPrice")) {
3851        this.unitPrice = new Money();
3852        return this.unitPrice;
3853      } else if (name.equals("factor")) {
3854        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.factor");
3855      } else if (name.equals("net")) {
3856        this.net = new Money();
3857        return this.net;
3858      } else if (name.equals("bodySite")) {
3859        this.bodySite = new CodeableConcept();
3860        return this.bodySite;
3861      } else if (name.equals("subSite")) {
3862        return addSubSite();
3863      } else if (name.equals("noteNumber")) {
3864        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.noteNumber");
3865      } else if (name.equals("adjudication")) {
3866        return addAdjudication();
3867      } else if (name.equals("detail")) {
3868        return addDetail();
3869      } else
3870        return super.addChild(name);
3871    }
3872
3873    public AddedItemComponent copy() {
3874      AddedItemComponent dst = new AddedItemComponent();
3875      copyValues(dst);
3876      return dst;
3877    }
3878
3879    public void copyValues(AddedItemComponent dst) {
3880      super.copyValues(dst);
3881      if (itemSequence != null) {
3882        dst.itemSequence = new ArrayList<PositiveIntType>();
3883        for (PositiveIntType i : itemSequence)
3884          dst.itemSequence.add(i.copy());
3885      }
3886      ;
3887      if (detailSequence != null) {
3888        dst.detailSequence = new ArrayList<PositiveIntType>();
3889        for (PositiveIntType i : detailSequence)
3890          dst.detailSequence.add(i.copy());
3891      }
3892      ;
3893      if (subdetailSequence != null) {
3894        dst.subdetailSequence = new ArrayList<PositiveIntType>();
3895        for (PositiveIntType i : subdetailSequence)
3896          dst.subdetailSequence.add(i.copy());
3897      }
3898      ;
3899      if (provider != null) {
3900        dst.provider = new ArrayList<Reference>();
3901        for (Reference i : provider)
3902          dst.provider.add(i.copy());
3903      }
3904      ;
3905      dst.productOrService = productOrService == null ? null : productOrService.copy();
3906      if (modifier != null) {
3907        dst.modifier = new ArrayList<CodeableConcept>();
3908        for (CodeableConcept i : modifier)
3909          dst.modifier.add(i.copy());
3910      }
3911      ;
3912      if (programCode != null) {
3913        dst.programCode = new ArrayList<CodeableConcept>();
3914        for (CodeableConcept i : programCode)
3915          dst.programCode.add(i.copy());
3916      }
3917      ;
3918      dst.serviced = serviced == null ? null : serviced.copy();
3919      dst.location = location == null ? null : location.copy();
3920      dst.quantity = quantity == null ? null : quantity.copy();
3921      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
3922      dst.factor = factor == null ? null : factor.copy();
3923      dst.net = net == null ? null : net.copy();
3924      dst.bodySite = bodySite == null ? null : bodySite.copy();
3925      if (subSite != null) {
3926        dst.subSite = new ArrayList<CodeableConcept>();
3927        for (CodeableConcept i : subSite)
3928          dst.subSite.add(i.copy());
3929      }
3930      ;
3931      if (noteNumber != null) {
3932        dst.noteNumber = new ArrayList<PositiveIntType>();
3933        for (PositiveIntType i : noteNumber)
3934          dst.noteNumber.add(i.copy());
3935      }
3936      ;
3937      if (adjudication != null) {
3938        dst.adjudication = new ArrayList<AdjudicationComponent>();
3939        for (AdjudicationComponent i : adjudication)
3940          dst.adjudication.add(i.copy());
3941      }
3942      ;
3943      if (detail != null) {
3944        dst.detail = new ArrayList<AddedItemDetailComponent>();
3945        for (AddedItemDetailComponent i : detail)
3946          dst.detail.add(i.copy());
3947      }
3948      ;
3949    }
3950
3951    @Override
3952    public boolean equalsDeep(Base other_) {
3953      if (!super.equalsDeep(other_))
3954        return false;
3955      if (!(other_ instanceof AddedItemComponent))
3956        return false;
3957      AddedItemComponent o = (AddedItemComponent) other_;
3958      return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
3959          && compareDeep(subdetailSequence, o.subdetailSequence, true) && compareDeep(provider, o.provider, true)
3960          && compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
3961          && compareDeep(programCode, o.programCode, true) && compareDeep(serviced, o.serviced, true)
3962          && compareDeep(location, o.location, true) && compareDeep(quantity, o.quantity, true)
3963          && compareDeep(unitPrice, o.unitPrice, true) && compareDeep(factor, o.factor, true)
3964          && compareDeep(net, o.net, true) && compareDeep(bodySite, o.bodySite, true)
3965          && compareDeep(subSite, o.subSite, true) && compareDeep(noteNumber, o.noteNumber, true)
3966          && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
3967    }
3968
3969    @Override
3970    public boolean equalsShallow(Base other_) {
3971      if (!super.equalsShallow(other_))
3972        return false;
3973      if (!(other_ instanceof AddedItemComponent))
3974        return false;
3975      AddedItemComponent o = (AddedItemComponent) other_;
3976      return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
3977          && compareValues(subdetailSequence, o.subdetailSequence, true) && compareValues(factor, o.factor, true)
3978          && compareValues(noteNumber, o.noteNumber, true);
3979    }
3980
3981    public boolean isEmpty() {
3982      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence, subdetailSequence,
3983          provider, productOrService, modifier, programCode, serviced, location, quantity, unitPrice, factor, net,
3984          bodySite, subSite, noteNumber, adjudication, detail);
3985    }
3986
3987    public String fhirType() {
3988      return "ClaimResponse.addItem";
3989
3990    }
3991
3992  }
3993
3994  @Block()
3995  public static class AddedItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
3996    /**
3997     * When the value is a group code then this item collects a set of related claim
3998     * details, otherwise this contains the product, service, drug or other billing
3999     * code for the item.
4000     */
4001    @Child(name = "productOrService", type = {
4002        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4003    @Description(shortDefinition = "Billing, service, product, or drug code", formalDefinition = "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.")
4004    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
4005    protected CodeableConcept productOrService;
4006
4007    /**
4008     * Item typification or modifiers codes to convey additional context for the
4009     * product or service.
4010     */
4011    @Child(name = "modifier", type = {
4012        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4013    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
4014    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
4015    protected List<CodeableConcept> modifier;
4016
4017    /**
4018     * The number of repetitions of a service or product.
4019     */
4020    @Child(name = "quantity", type = { Quantity.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
4021    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
4022    protected Quantity quantity;
4023
4024    /**
4025     * If the item is not a group then this is the fee for the product or service,
4026     * otherwise this is the total of the fees for the details of the group.
4027     */
4028    @Child(name = "unitPrice", type = { Money.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
4029    @Description(shortDefinition = "Fee, charge or cost per item", formalDefinition = "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.")
4030    protected Money unitPrice;
4031
4032    /**
4033     * A real number that represents a multiplier used in determining the overall
4034     * value of services delivered and/or goods received. The concept of a Factor
4035     * allows for a discount or surcharge multiplier to be applied to a monetary
4036     * amount.
4037     */
4038    @Child(name = "factor", type = {
4039        DecimalType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
4040    @Description(shortDefinition = "Price scaling factor", formalDefinition = "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.")
4041    protected DecimalType factor;
4042
4043    /**
4044     * The quantity times the unit price for an additional service or product or
4045     * charge.
4046     */
4047    @Child(name = "net", type = { Money.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
4048    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
4049    protected Money net;
4050
4051    /**
4052     * The numbers associated with notes below which apply to the adjudication of
4053     * this item.
4054     */
4055    @Child(name = "noteNumber", type = {
4056        PositiveIntType.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4057    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
4058    protected List<PositiveIntType> noteNumber;
4059
4060    /**
4061     * The adjudication results.
4062     */
4063    @Child(name = "adjudication", type = {
4064        AdjudicationComponent.class }, order = 8, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4065    @Description(shortDefinition = "Added items detail adjudication", formalDefinition = "The adjudication results.")
4066    protected List<AdjudicationComponent> adjudication;
4067
4068    /**
4069     * The third-tier service adjudications for payor added services.
4070     */
4071    @Child(name = "subDetail", type = {}, order = 9, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4072    @Description(shortDefinition = "Insurer added line items", formalDefinition = "The third-tier service adjudications for payor added services.")
4073    protected List<AddedItemSubDetailComponent> subDetail;
4074
4075    private static final long serialVersionUID = -1436724060L;
4076
4077    /**
4078     * Constructor
4079     */
4080    public AddedItemDetailComponent() {
4081      super();
4082    }
4083
4084    /**
4085     * Constructor
4086     */
4087    public AddedItemDetailComponent(CodeableConcept productOrService) {
4088      super();
4089      this.productOrService = productOrService;
4090    }
4091
4092    /**
4093     * @return {@link #productOrService} (When the value is a group code then this
4094     *         item collects a set of related claim details, otherwise this contains
4095     *         the product, service, drug or other billing code for the item.)
4096     */
4097    public CodeableConcept getProductOrService() {
4098      if (this.productOrService == null)
4099        if (Configuration.errorOnAutoCreate())
4100          throw new Error("Attempt to auto-create AddedItemDetailComponent.productOrService");
4101        else if (Configuration.doAutoCreate())
4102          this.productOrService = new CodeableConcept(); // cc
4103      return this.productOrService;
4104    }
4105
4106    public boolean hasProductOrService() {
4107      return this.productOrService != null && !this.productOrService.isEmpty();
4108    }
4109
4110    /**
4111     * @param value {@link #productOrService} (When the value is a group code then
4112     *              this item collects a set of related claim details, otherwise
4113     *              this contains the product, service, drug or other billing code
4114     *              for the item.)
4115     */
4116    public AddedItemDetailComponent setProductOrService(CodeableConcept value) {
4117      this.productOrService = value;
4118      return this;
4119    }
4120
4121    /**
4122     * @return {@link #modifier} (Item typification or modifiers codes to convey
4123     *         additional context for the product or service.)
4124     */
4125    public List<CodeableConcept> getModifier() {
4126      if (this.modifier == null)
4127        this.modifier = new ArrayList<CodeableConcept>();
4128      return this.modifier;
4129    }
4130
4131    /**
4132     * @return Returns a reference to <code>this</code> for easy method chaining
4133     */
4134    public AddedItemDetailComponent setModifier(List<CodeableConcept> theModifier) {
4135      this.modifier = theModifier;
4136      return this;
4137    }
4138
4139    public boolean hasModifier() {
4140      if (this.modifier == null)
4141        return false;
4142      for (CodeableConcept item : this.modifier)
4143        if (!item.isEmpty())
4144          return true;
4145      return false;
4146    }
4147
4148    public CodeableConcept addModifier() { // 3
4149      CodeableConcept t = new CodeableConcept();
4150      if (this.modifier == null)
4151        this.modifier = new ArrayList<CodeableConcept>();
4152      this.modifier.add(t);
4153      return t;
4154    }
4155
4156    public AddedItemDetailComponent addModifier(CodeableConcept t) { // 3
4157      if (t == null)
4158        return this;
4159      if (this.modifier == null)
4160        this.modifier = new ArrayList<CodeableConcept>();
4161      this.modifier.add(t);
4162      return this;
4163    }
4164
4165    /**
4166     * @return The first repetition of repeating field {@link #modifier}, creating
4167     *         it if it does not already exist
4168     */
4169    public CodeableConcept getModifierFirstRep() {
4170      if (getModifier().isEmpty()) {
4171        addModifier();
4172      }
4173      return getModifier().get(0);
4174    }
4175
4176    /**
4177     * @return {@link #quantity} (The number of repetitions of a service or
4178     *         product.)
4179     */
4180    public Quantity getQuantity() {
4181      if (this.quantity == null)
4182        if (Configuration.errorOnAutoCreate())
4183          throw new Error("Attempt to auto-create AddedItemDetailComponent.quantity");
4184        else if (Configuration.doAutoCreate())
4185          this.quantity = new Quantity(); // cc
4186      return this.quantity;
4187    }
4188
4189    public boolean hasQuantity() {
4190      return this.quantity != null && !this.quantity.isEmpty();
4191    }
4192
4193    /**
4194     * @param value {@link #quantity} (The number of repetitions of a service or
4195     *              product.)
4196     */
4197    public AddedItemDetailComponent setQuantity(Quantity value) {
4198      this.quantity = value;
4199      return this;
4200    }
4201
4202    /**
4203     * @return {@link #unitPrice} (If the item is not a group then this is the fee
4204     *         for the product or service, otherwise this is the total of the fees
4205     *         for the details of the group.)
4206     */
4207    public Money getUnitPrice() {
4208      if (this.unitPrice == null)
4209        if (Configuration.errorOnAutoCreate())
4210          throw new Error("Attempt to auto-create AddedItemDetailComponent.unitPrice");
4211        else if (Configuration.doAutoCreate())
4212          this.unitPrice = new Money(); // cc
4213      return this.unitPrice;
4214    }
4215
4216    public boolean hasUnitPrice() {
4217      return this.unitPrice != null && !this.unitPrice.isEmpty();
4218    }
4219
4220    /**
4221     * @param value {@link #unitPrice} (If the item is not a group then this is the
4222     *              fee for the product or service, otherwise this is the total of
4223     *              the fees for the details of the group.)
4224     */
4225    public AddedItemDetailComponent setUnitPrice(Money value) {
4226      this.unitPrice = value;
4227      return this;
4228    }
4229
4230    /**
4231     * @return {@link #factor} (A real number that represents a multiplier used in
4232     *         determining the overall value of services delivered and/or goods
4233     *         received. The concept of a Factor allows for a discount or surcharge
4234     *         multiplier to be applied to a monetary amount.). This is the
4235     *         underlying object with id, value and extensions. The accessor
4236     *         "getFactor" gives direct access to the value
4237     */
4238    public DecimalType getFactorElement() {
4239      if (this.factor == null)
4240        if (Configuration.errorOnAutoCreate())
4241          throw new Error("Attempt to auto-create AddedItemDetailComponent.factor");
4242        else if (Configuration.doAutoCreate())
4243          this.factor = new DecimalType(); // bb
4244      return this.factor;
4245    }
4246
4247    public boolean hasFactorElement() {
4248      return this.factor != null && !this.factor.isEmpty();
4249    }
4250
4251    public boolean hasFactor() {
4252      return this.factor != null && !this.factor.isEmpty();
4253    }
4254
4255    /**
4256     * @param value {@link #factor} (A real number that represents a multiplier used
4257     *              in determining the overall value of services delivered and/or
4258     *              goods received. The concept of a Factor allows for a discount or
4259     *              surcharge multiplier to be applied to a monetary amount.). This
4260     *              is the underlying object with id, value and extensions. The
4261     *              accessor "getFactor" gives direct access to the value
4262     */
4263    public AddedItemDetailComponent setFactorElement(DecimalType value) {
4264      this.factor = value;
4265      return this;
4266    }
4267
4268    /**
4269     * @return A real number that represents a multiplier used in determining the
4270     *         overall value of services delivered and/or goods received. The
4271     *         concept of a Factor allows for a discount or surcharge multiplier to
4272     *         be applied to a monetary amount.
4273     */
4274    public BigDecimal getFactor() {
4275      return this.factor == null ? null : this.factor.getValue();
4276    }
4277
4278    /**
4279     * @param value A real number that represents a multiplier used in determining
4280     *              the overall value of services delivered and/or goods received.
4281     *              The concept of a Factor allows for a discount or surcharge
4282     *              multiplier to be applied to a monetary amount.
4283     */
4284    public AddedItemDetailComponent setFactor(BigDecimal value) {
4285      if (value == null)
4286        this.factor = null;
4287      else {
4288        if (this.factor == null)
4289          this.factor = new DecimalType();
4290        this.factor.setValue(value);
4291      }
4292      return this;
4293    }
4294
4295    /**
4296     * @param value A real number that represents a multiplier used in determining
4297     *              the overall value of services delivered and/or goods received.
4298     *              The concept of a Factor allows for a discount or surcharge
4299     *              multiplier to be applied to a monetary amount.
4300     */
4301    public AddedItemDetailComponent setFactor(long value) {
4302      this.factor = new DecimalType();
4303      this.factor.setValue(value);
4304      return this;
4305    }
4306
4307    /**
4308     * @param value A real number that represents a multiplier used in determining
4309     *              the overall value of services delivered and/or goods received.
4310     *              The concept of a Factor allows for a discount or surcharge
4311     *              multiplier to be applied to a monetary amount.
4312     */
4313    public AddedItemDetailComponent setFactor(double value) {
4314      this.factor = new DecimalType();
4315      this.factor.setValue(value);
4316      return this;
4317    }
4318
4319    /**
4320     * @return {@link #net} (The quantity times the unit price for an additional
4321     *         service or product or charge.)
4322     */
4323    public Money getNet() {
4324      if (this.net == null)
4325        if (Configuration.errorOnAutoCreate())
4326          throw new Error("Attempt to auto-create AddedItemDetailComponent.net");
4327        else if (Configuration.doAutoCreate())
4328          this.net = new Money(); // cc
4329      return this.net;
4330    }
4331
4332    public boolean hasNet() {
4333      return this.net != null && !this.net.isEmpty();
4334    }
4335
4336    /**
4337     * @param value {@link #net} (The quantity times the unit price for an
4338     *              additional service or product or charge.)
4339     */
4340    public AddedItemDetailComponent setNet(Money value) {
4341      this.net = value;
4342      return this;
4343    }
4344
4345    /**
4346     * @return {@link #noteNumber} (The numbers associated with notes below which
4347     *         apply to the adjudication of this item.)
4348     */
4349    public List<PositiveIntType> getNoteNumber() {
4350      if (this.noteNumber == null)
4351        this.noteNumber = new ArrayList<PositiveIntType>();
4352      return this.noteNumber;
4353    }
4354
4355    /**
4356     * @return Returns a reference to <code>this</code> for easy method chaining
4357     */
4358    public AddedItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
4359      this.noteNumber = theNoteNumber;
4360      return this;
4361    }
4362
4363    public boolean hasNoteNumber() {
4364      if (this.noteNumber == null)
4365        return false;
4366      for (PositiveIntType item : this.noteNumber)
4367        if (!item.isEmpty())
4368          return true;
4369      return false;
4370    }
4371
4372    /**
4373     * @return {@link #noteNumber} (The numbers associated with notes below which
4374     *         apply to the adjudication of this item.)
4375     */
4376    public PositiveIntType addNoteNumberElement() {// 2
4377      PositiveIntType t = new PositiveIntType();
4378      if (this.noteNumber == null)
4379        this.noteNumber = new ArrayList<PositiveIntType>();
4380      this.noteNumber.add(t);
4381      return t;
4382    }
4383
4384    /**
4385     * @param value {@link #noteNumber} (The numbers associated with notes below
4386     *              which apply to the adjudication of this item.)
4387     */
4388    public AddedItemDetailComponent addNoteNumber(int value) { // 1
4389      PositiveIntType t = new PositiveIntType();
4390      t.setValue(value);
4391      if (this.noteNumber == null)
4392        this.noteNumber = new ArrayList<PositiveIntType>();
4393      this.noteNumber.add(t);
4394      return this;
4395    }
4396
4397    /**
4398     * @param value {@link #noteNumber} (The numbers associated with notes below
4399     *              which apply to the adjudication of this item.)
4400     */
4401    public boolean hasNoteNumber(int value) {
4402      if (this.noteNumber == null)
4403        return false;
4404      for (PositiveIntType v : this.noteNumber)
4405        if (v.getValue().equals(value)) // positiveInt
4406          return true;
4407      return false;
4408    }
4409
4410    /**
4411     * @return {@link #adjudication} (The adjudication results.)
4412     */
4413    public List<AdjudicationComponent> getAdjudication() {
4414      if (this.adjudication == null)
4415        this.adjudication = new ArrayList<AdjudicationComponent>();
4416      return this.adjudication;
4417    }
4418
4419    /**
4420     * @return Returns a reference to <code>this</code> for easy method chaining
4421     */
4422    public AddedItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
4423      this.adjudication = theAdjudication;
4424      return this;
4425    }
4426
4427    public boolean hasAdjudication() {
4428      if (this.adjudication == null)
4429        return false;
4430      for (AdjudicationComponent item : this.adjudication)
4431        if (!item.isEmpty())
4432          return true;
4433      return false;
4434    }
4435
4436    public AdjudicationComponent addAdjudication() { // 3
4437      AdjudicationComponent t = new AdjudicationComponent();
4438      if (this.adjudication == null)
4439        this.adjudication = new ArrayList<AdjudicationComponent>();
4440      this.adjudication.add(t);
4441      return t;
4442    }
4443
4444    public AddedItemDetailComponent addAdjudication(AdjudicationComponent t) { // 3
4445      if (t == null)
4446        return this;
4447      if (this.adjudication == null)
4448        this.adjudication = new ArrayList<AdjudicationComponent>();
4449      this.adjudication.add(t);
4450      return this;
4451    }
4452
4453    /**
4454     * @return The first repetition of repeating field {@link #adjudication},
4455     *         creating it if it does not already exist
4456     */
4457    public AdjudicationComponent getAdjudicationFirstRep() {
4458      if (getAdjudication().isEmpty()) {
4459        addAdjudication();
4460      }
4461      return getAdjudication().get(0);
4462    }
4463
4464    /**
4465     * @return {@link #subDetail} (The third-tier service adjudications for payor
4466     *         added services.)
4467     */
4468    public List<AddedItemSubDetailComponent> getSubDetail() {
4469      if (this.subDetail == null)
4470        this.subDetail = new ArrayList<AddedItemSubDetailComponent>();
4471      return this.subDetail;
4472    }
4473
4474    /**
4475     * @return Returns a reference to <code>this</code> for easy method chaining
4476     */
4477    public AddedItemDetailComponent setSubDetail(List<AddedItemSubDetailComponent> theSubDetail) {
4478      this.subDetail = theSubDetail;
4479      return this;
4480    }
4481
4482    public boolean hasSubDetail() {
4483      if (this.subDetail == null)
4484        return false;
4485      for (AddedItemSubDetailComponent item : this.subDetail)
4486        if (!item.isEmpty())
4487          return true;
4488      return false;
4489    }
4490
4491    public AddedItemSubDetailComponent addSubDetail() { // 3
4492      AddedItemSubDetailComponent t = new AddedItemSubDetailComponent();
4493      if (this.subDetail == null)
4494        this.subDetail = new ArrayList<AddedItemSubDetailComponent>();
4495      this.subDetail.add(t);
4496      return t;
4497    }
4498
4499    public AddedItemDetailComponent addSubDetail(AddedItemSubDetailComponent t) { // 3
4500      if (t == null)
4501        return this;
4502      if (this.subDetail == null)
4503        this.subDetail = new ArrayList<AddedItemSubDetailComponent>();
4504      this.subDetail.add(t);
4505      return this;
4506    }
4507
4508    /**
4509     * @return The first repetition of repeating field {@link #subDetail}, creating
4510     *         it if it does not already exist
4511     */
4512    public AddedItemSubDetailComponent getSubDetailFirstRep() {
4513      if (getSubDetail().isEmpty()) {
4514        addSubDetail();
4515      }
4516      return getSubDetail().get(0);
4517    }
4518
4519    protected void listChildren(List<Property> children) {
4520      super.listChildren(children);
4521      children.add(new Property("productOrService", "CodeableConcept",
4522          "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.",
4523          0, 1, productOrService));
4524      children.add(new Property("modifier", "CodeableConcept",
4525          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
4526          java.lang.Integer.MAX_VALUE, modifier));
4527      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
4528          1, quantity));
4529      children.add(new Property("unitPrice", "Money",
4530          "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.",
4531          0, 1, unitPrice));
4532      children.add(new Property("factor", "decimal",
4533          "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
4534          0, 1, factor));
4535      children.add(new Property("net", "Money",
4536          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
4537      children.add(new Property("noteNumber", "positiveInt",
4538          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
4539          java.lang.Integer.MAX_VALUE, noteNumber));
4540      children.add(new Property("adjudication", "@ClaimResponse.item.adjudication", "The adjudication results.", 0,
4541          java.lang.Integer.MAX_VALUE, adjudication));
4542      children.add(new Property("subDetail", "", "The third-tier service adjudications for payor added services.", 0,
4543          java.lang.Integer.MAX_VALUE, subDetail));
4544    }
4545
4546    @Override
4547    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
4548      switch (_hash) {
4549      case 1957227299:
4550        /* productOrService */ return new Property("productOrService", "CodeableConcept",
4551            "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.",
4552            0, 1, productOrService);
4553      case -615513385:
4554        /* modifier */ return new Property("modifier", "CodeableConcept",
4555            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
4556            java.lang.Integer.MAX_VALUE, modifier);
4557      case -1285004149:
4558        /* quantity */ return new Property("quantity", "SimpleQuantity",
4559            "The number of repetitions of a service or product.", 0, 1, quantity);
4560      case -486196699:
4561        /* unitPrice */ return new Property("unitPrice", "Money",
4562            "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.",
4563            0, 1, unitPrice);
4564      case -1282148017:
4565        /* factor */ return new Property("factor", "decimal",
4566            "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
4567            0, 1, factor);
4568      case 108957:
4569        /* net */ return new Property("net", "Money",
4570            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
4571      case -1110033957:
4572        /* noteNumber */ return new Property("noteNumber", "positiveInt",
4573            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
4574            java.lang.Integer.MAX_VALUE, noteNumber);
4575      case -231349275:
4576        /* adjudication */ return new Property("adjudication", "@ClaimResponse.item.adjudication",
4577            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
4578      case -828829007:
4579        /* subDetail */ return new Property("subDetail", "",
4580            "The third-tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE,
4581            subDetail);
4582      default:
4583        return super.getNamedProperty(_hash, _name, _checkValid);
4584      }
4585
4586    }
4587
4588    @Override
4589    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4590      switch (hash) {
4591      case 1957227299:
4592        /* productOrService */ return this.productOrService == null ? new Base[0]
4593            : new Base[] { this.productOrService }; // CodeableConcept
4594      case -615513385:
4595        /* modifier */ return this.modifier == null ? new Base[0]
4596            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
4597      case -1285004149:
4598        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
4599      case -486196699:
4600        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
4601      case -1282148017:
4602        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
4603      case 108957:
4604        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
4605      case -1110033957:
4606        /* noteNumber */ return this.noteNumber == null ? new Base[0]
4607            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
4608      case -231349275:
4609        /* adjudication */ return this.adjudication == null ? new Base[0]
4610            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
4611      case -828829007:
4612        /* subDetail */ return this.subDetail == null ? new Base[0]
4613            : this.subDetail.toArray(new Base[this.subDetail.size()]); // AddedItemSubDetailComponent
4614      default:
4615        return super.getProperty(hash, name, checkValid);
4616      }
4617
4618    }
4619
4620    @Override
4621    public Base setProperty(int hash, String name, Base value) throws FHIRException {
4622      switch (hash) {
4623      case 1957227299: // productOrService
4624        this.productOrService = castToCodeableConcept(value); // CodeableConcept
4625        return value;
4626      case -615513385: // modifier
4627        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
4628        return value;
4629      case -1285004149: // quantity
4630        this.quantity = castToQuantity(value); // Quantity
4631        return value;
4632      case -486196699: // unitPrice
4633        this.unitPrice = castToMoney(value); // Money
4634        return value;
4635      case -1282148017: // factor
4636        this.factor = castToDecimal(value); // DecimalType
4637        return value;
4638      case 108957: // net
4639        this.net = castToMoney(value); // Money
4640        return value;
4641      case -1110033957: // noteNumber
4642        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
4643        return value;
4644      case -231349275: // adjudication
4645        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
4646        return value;
4647      case -828829007: // subDetail
4648        this.getSubDetail().add((AddedItemSubDetailComponent) value); // AddedItemSubDetailComponent
4649        return value;
4650      default:
4651        return super.setProperty(hash, name, value);
4652      }
4653
4654    }
4655
4656    @Override
4657    public Base setProperty(String name, Base value) throws FHIRException {
4658      if (name.equals("productOrService")) {
4659        this.productOrService = castToCodeableConcept(value); // CodeableConcept
4660      } else if (name.equals("modifier")) {
4661        this.getModifier().add(castToCodeableConcept(value));
4662      } else if (name.equals("quantity")) {
4663        this.quantity = castToQuantity(value); // Quantity
4664      } else if (name.equals("unitPrice")) {
4665        this.unitPrice = castToMoney(value); // Money
4666      } else if (name.equals("factor")) {
4667        this.factor = castToDecimal(value); // DecimalType
4668      } else if (name.equals("net")) {
4669        this.net = castToMoney(value); // Money
4670      } else if (name.equals("noteNumber")) {
4671        this.getNoteNumber().add(castToPositiveInt(value));
4672      } else if (name.equals("adjudication")) {
4673        this.getAdjudication().add((AdjudicationComponent) value);
4674      } else if (name.equals("subDetail")) {
4675        this.getSubDetail().add((AddedItemSubDetailComponent) value);
4676      } else
4677        return super.setProperty(name, value);
4678      return value;
4679    }
4680
4681    @Override
4682    public Base makeProperty(int hash, String name) throws FHIRException {
4683      switch (hash) {
4684      case 1957227299:
4685        return getProductOrService();
4686      case -615513385:
4687        return addModifier();
4688      case -1285004149:
4689        return getQuantity();
4690      case -486196699:
4691        return getUnitPrice();
4692      case -1282148017:
4693        return getFactorElement();
4694      case 108957:
4695        return getNet();
4696      case -1110033957:
4697        return addNoteNumberElement();
4698      case -231349275:
4699        return addAdjudication();
4700      case -828829007:
4701        return addSubDetail();
4702      default:
4703        return super.makeProperty(hash, name);
4704      }
4705
4706    }
4707
4708    @Override
4709    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4710      switch (hash) {
4711      case 1957227299:
4712        /* productOrService */ return new String[] { "CodeableConcept" };
4713      case -615513385:
4714        /* modifier */ return new String[] { "CodeableConcept" };
4715      case -1285004149:
4716        /* quantity */ return new String[] { "SimpleQuantity" };
4717      case -486196699:
4718        /* unitPrice */ return new String[] { "Money" };
4719      case -1282148017:
4720        /* factor */ return new String[] { "decimal" };
4721      case 108957:
4722        /* net */ return new String[] { "Money" };
4723      case -1110033957:
4724        /* noteNumber */ return new String[] { "positiveInt" };
4725      case -231349275:
4726        /* adjudication */ return new String[] { "@ClaimResponse.item.adjudication" };
4727      case -828829007:
4728        /* subDetail */ return new String[] {};
4729      default:
4730        return super.getTypesForProperty(hash, name);
4731      }
4732
4733    }
4734
4735    @Override
4736    public Base addChild(String name) throws FHIRException {
4737      if (name.equals("productOrService")) {
4738        this.productOrService = new CodeableConcept();
4739        return this.productOrService;
4740      } else if (name.equals("modifier")) {
4741        return addModifier();
4742      } else if (name.equals("quantity")) {
4743        this.quantity = new Quantity();
4744        return this.quantity;
4745      } else if (name.equals("unitPrice")) {
4746        this.unitPrice = new Money();
4747        return this.unitPrice;
4748      } else if (name.equals("factor")) {
4749        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.factor");
4750      } else if (name.equals("net")) {
4751        this.net = new Money();
4752        return this.net;
4753      } else if (name.equals("noteNumber")) {
4754        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.noteNumber");
4755      } else if (name.equals("adjudication")) {
4756        return addAdjudication();
4757      } else if (name.equals("subDetail")) {
4758        return addSubDetail();
4759      } else
4760        return super.addChild(name);
4761    }
4762
4763    public AddedItemDetailComponent copy() {
4764      AddedItemDetailComponent dst = new AddedItemDetailComponent();
4765      copyValues(dst);
4766      return dst;
4767    }
4768
4769    public void copyValues(AddedItemDetailComponent dst) {
4770      super.copyValues(dst);
4771      dst.productOrService = productOrService == null ? null : productOrService.copy();
4772      if (modifier != null) {
4773        dst.modifier = new ArrayList<CodeableConcept>();
4774        for (CodeableConcept i : modifier)
4775          dst.modifier.add(i.copy());
4776      }
4777      ;
4778      dst.quantity = quantity == null ? null : quantity.copy();
4779      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
4780      dst.factor = factor == null ? null : factor.copy();
4781      dst.net = net == null ? null : net.copy();
4782      if (noteNumber != null) {
4783        dst.noteNumber = new ArrayList<PositiveIntType>();
4784        for (PositiveIntType i : noteNumber)
4785          dst.noteNumber.add(i.copy());
4786      }
4787      ;
4788      if (adjudication != null) {
4789        dst.adjudication = new ArrayList<AdjudicationComponent>();
4790        for (AdjudicationComponent i : adjudication)
4791          dst.adjudication.add(i.copy());
4792      }
4793      ;
4794      if (subDetail != null) {
4795        dst.subDetail = new ArrayList<AddedItemSubDetailComponent>();
4796        for (AddedItemSubDetailComponent i : subDetail)
4797          dst.subDetail.add(i.copy());
4798      }
4799      ;
4800    }
4801
4802    @Override
4803    public boolean equalsDeep(Base other_) {
4804      if (!super.equalsDeep(other_))
4805        return false;
4806      if (!(other_ instanceof AddedItemDetailComponent))
4807        return false;
4808      AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
4809      return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
4810          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
4811          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
4812          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
4813          && compareDeep(subDetail, o.subDetail, true);
4814    }
4815
4816    @Override
4817    public boolean equalsShallow(Base other_) {
4818      if (!super.equalsShallow(other_))
4819        return false;
4820      if (!(other_ instanceof AddedItemDetailComponent))
4821        return false;
4822      AddedItemDetailComponent o = (AddedItemDetailComponent) other_;
4823      return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
4824    }
4825
4826    public boolean isEmpty() {
4827      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier, quantity, unitPrice,
4828          factor, net, noteNumber, adjudication, subDetail);
4829    }
4830
4831    public String fhirType() {
4832      return "ClaimResponse.addItem.detail";
4833
4834    }
4835
4836  }
4837
4838  @Block()
4839  public static class AddedItemSubDetailComponent extends BackboneElement implements IBaseBackboneElement {
4840    /**
4841     * When the value is a group code then this item collects a set of related claim
4842     * details, otherwise this contains the product, service, drug or other billing
4843     * code for the item.
4844     */
4845    @Child(name = "productOrService", type = {
4846        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
4847    @Description(shortDefinition = "Billing, service, product, or drug code", formalDefinition = "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.")
4848    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/service-uscls")
4849    protected CodeableConcept productOrService;
4850
4851    /**
4852     * Item typification or modifiers codes to convey additional context for the
4853     * product or service.
4854     */
4855    @Child(name = "modifier", type = {
4856        CodeableConcept.class }, order = 2, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4857    @Description(shortDefinition = "Service/Product billing modifiers", formalDefinition = "Item typification or modifiers codes to convey additional context for the product or service.")
4858    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-modifiers")
4859    protected List<CodeableConcept> modifier;
4860
4861    /**
4862     * The number of repetitions of a service or product.
4863     */
4864    @Child(name = "quantity", type = { Quantity.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
4865    @Description(shortDefinition = "Count of products or services", formalDefinition = "The number of repetitions of a service or product.")
4866    protected Quantity quantity;
4867
4868    /**
4869     * If the item is not a group then this is the fee for the product or service,
4870     * otherwise this is the total of the fees for the details of the group.
4871     */
4872    @Child(name = "unitPrice", type = { Money.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
4873    @Description(shortDefinition = "Fee, charge or cost per item", formalDefinition = "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.")
4874    protected Money unitPrice;
4875
4876    /**
4877     * A real number that represents a multiplier used in determining the overall
4878     * value of services delivered and/or goods received. The concept of a Factor
4879     * allows for a discount or surcharge multiplier to be applied to a monetary
4880     * amount.
4881     */
4882    @Child(name = "factor", type = {
4883        DecimalType.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
4884    @Description(shortDefinition = "Price scaling factor", formalDefinition = "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.")
4885    protected DecimalType factor;
4886
4887    /**
4888     * The quantity times the unit price for an additional service or product or
4889     * charge.
4890     */
4891    @Child(name = "net", type = { Money.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
4892    @Description(shortDefinition = "Total item cost", formalDefinition = "The quantity times the unit price for an additional service or product or charge.")
4893    protected Money net;
4894
4895    /**
4896     * The numbers associated with notes below which apply to the adjudication of
4897     * this item.
4898     */
4899    @Child(name = "noteNumber", type = {
4900        PositiveIntType.class }, order = 7, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4901    @Description(shortDefinition = "Applicable note numbers", formalDefinition = "The numbers associated with notes below which apply to the adjudication of this item.")
4902    protected List<PositiveIntType> noteNumber;
4903
4904    /**
4905     * The adjudication results.
4906     */
4907    @Child(name = "adjudication", type = {
4908        AdjudicationComponent.class }, order = 8, min = 1, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
4909    @Description(shortDefinition = "Added items detail adjudication", formalDefinition = "The adjudication results.")
4910    protected List<AdjudicationComponent> adjudication;
4911
4912    private static final long serialVersionUID = 1301363592L;
4913
4914    /**
4915     * Constructor
4916     */
4917    public AddedItemSubDetailComponent() {
4918      super();
4919    }
4920
4921    /**
4922     * Constructor
4923     */
4924    public AddedItemSubDetailComponent(CodeableConcept productOrService) {
4925      super();
4926      this.productOrService = productOrService;
4927    }
4928
4929    /**
4930     * @return {@link #productOrService} (When the value is a group code then this
4931     *         item collects a set of related claim details, otherwise this contains
4932     *         the product, service, drug or other billing code for the item.)
4933     */
4934    public CodeableConcept getProductOrService() {
4935      if (this.productOrService == null)
4936        if (Configuration.errorOnAutoCreate())
4937          throw new Error("Attempt to auto-create AddedItemSubDetailComponent.productOrService");
4938        else if (Configuration.doAutoCreate())
4939          this.productOrService = new CodeableConcept(); // cc
4940      return this.productOrService;
4941    }
4942
4943    public boolean hasProductOrService() {
4944      return this.productOrService != null && !this.productOrService.isEmpty();
4945    }
4946
4947    /**
4948     * @param value {@link #productOrService} (When the value is a group code then
4949     *              this item collects a set of related claim details, otherwise
4950     *              this contains the product, service, drug or other billing code
4951     *              for the item.)
4952     */
4953    public AddedItemSubDetailComponent setProductOrService(CodeableConcept value) {
4954      this.productOrService = value;
4955      return this;
4956    }
4957
4958    /**
4959     * @return {@link #modifier} (Item typification or modifiers codes to convey
4960     *         additional context for the product or service.)
4961     */
4962    public List<CodeableConcept> getModifier() {
4963      if (this.modifier == null)
4964        this.modifier = new ArrayList<CodeableConcept>();
4965      return this.modifier;
4966    }
4967
4968    /**
4969     * @return Returns a reference to <code>this</code> for easy method chaining
4970     */
4971    public AddedItemSubDetailComponent setModifier(List<CodeableConcept> theModifier) {
4972      this.modifier = theModifier;
4973      return this;
4974    }
4975
4976    public boolean hasModifier() {
4977      if (this.modifier == null)
4978        return false;
4979      for (CodeableConcept item : this.modifier)
4980        if (!item.isEmpty())
4981          return true;
4982      return false;
4983    }
4984
4985    public CodeableConcept addModifier() { // 3
4986      CodeableConcept t = new CodeableConcept();
4987      if (this.modifier == null)
4988        this.modifier = new ArrayList<CodeableConcept>();
4989      this.modifier.add(t);
4990      return t;
4991    }
4992
4993    public AddedItemSubDetailComponent addModifier(CodeableConcept t) { // 3
4994      if (t == null)
4995        return this;
4996      if (this.modifier == null)
4997        this.modifier = new ArrayList<CodeableConcept>();
4998      this.modifier.add(t);
4999      return this;
5000    }
5001
5002    /**
5003     * @return The first repetition of repeating field {@link #modifier}, creating
5004     *         it if it does not already exist
5005     */
5006    public CodeableConcept getModifierFirstRep() {
5007      if (getModifier().isEmpty()) {
5008        addModifier();
5009      }
5010      return getModifier().get(0);
5011    }
5012
5013    /**
5014     * @return {@link #quantity} (The number of repetitions of a service or
5015     *         product.)
5016     */
5017    public Quantity getQuantity() {
5018      if (this.quantity == null)
5019        if (Configuration.errorOnAutoCreate())
5020          throw new Error("Attempt to auto-create AddedItemSubDetailComponent.quantity");
5021        else if (Configuration.doAutoCreate())
5022          this.quantity = new Quantity(); // cc
5023      return this.quantity;
5024    }
5025
5026    public boolean hasQuantity() {
5027      return this.quantity != null && !this.quantity.isEmpty();
5028    }
5029
5030    /**
5031     * @param value {@link #quantity} (The number of repetitions of a service or
5032     *              product.)
5033     */
5034    public AddedItemSubDetailComponent setQuantity(Quantity value) {
5035      this.quantity = value;
5036      return this;
5037    }
5038
5039    /**
5040     * @return {@link #unitPrice} (If the item is not a group then this is the fee
5041     *         for the product or service, otherwise this is the total of the fees
5042     *         for the details of the group.)
5043     */
5044    public Money getUnitPrice() {
5045      if (this.unitPrice == null)
5046        if (Configuration.errorOnAutoCreate())
5047          throw new Error("Attempt to auto-create AddedItemSubDetailComponent.unitPrice");
5048        else if (Configuration.doAutoCreate())
5049          this.unitPrice = new Money(); // cc
5050      return this.unitPrice;
5051    }
5052
5053    public boolean hasUnitPrice() {
5054      return this.unitPrice != null && !this.unitPrice.isEmpty();
5055    }
5056
5057    /**
5058     * @param value {@link #unitPrice} (If the item is not a group then this is the
5059     *              fee for the product or service, otherwise this is the total of
5060     *              the fees for the details of the group.)
5061     */
5062    public AddedItemSubDetailComponent setUnitPrice(Money value) {
5063      this.unitPrice = value;
5064      return this;
5065    }
5066
5067    /**
5068     * @return {@link #factor} (A real number that represents a multiplier used in
5069     *         determining the overall value of services delivered and/or goods
5070     *         received. The concept of a Factor allows for a discount or surcharge
5071     *         multiplier to be applied to a monetary amount.). This is the
5072     *         underlying object with id, value and extensions. The accessor
5073     *         "getFactor" gives direct access to the value
5074     */
5075    public DecimalType getFactorElement() {
5076      if (this.factor == null)
5077        if (Configuration.errorOnAutoCreate())
5078          throw new Error("Attempt to auto-create AddedItemSubDetailComponent.factor");
5079        else if (Configuration.doAutoCreate())
5080          this.factor = new DecimalType(); // bb
5081      return this.factor;
5082    }
5083
5084    public boolean hasFactorElement() {
5085      return this.factor != null && !this.factor.isEmpty();
5086    }
5087
5088    public boolean hasFactor() {
5089      return this.factor != null && !this.factor.isEmpty();
5090    }
5091
5092    /**
5093     * @param value {@link #factor} (A real number that represents a multiplier used
5094     *              in determining the overall value of services delivered and/or
5095     *              goods received. The concept of a Factor allows for a discount or
5096     *              surcharge multiplier to be applied to a monetary amount.). This
5097     *              is the underlying object with id, value and extensions. The
5098     *              accessor "getFactor" gives direct access to the value
5099     */
5100    public AddedItemSubDetailComponent setFactorElement(DecimalType value) {
5101      this.factor = value;
5102      return this;
5103    }
5104
5105    /**
5106     * @return A real number that represents a multiplier used in determining the
5107     *         overall value of services delivered and/or goods received. The
5108     *         concept of a Factor allows for a discount or surcharge multiplier to
5109     *         be applied to a monetary amount.
5110     */
5111    public BigDecimal getFactor() {
5112      return this.factor == null ? null : this.factor.getValue();
5113    }
5114
5115    /**
5116     * @param value A real number that represents a multiplier used in determining
5117     *              the overall value of services delivered and/or goods received.
5118     *              The concept of a Factor allows for a discount or surcharge
5119     *              multiplier to be applied to a monetary amount.
5120     */
5121    public AddedItemSubDetailComponent setFactor(BigDecimal value) {
5122      if (value == null)
5123        this.factor = null;
5124      else {
5125        if (this.factor == null)
5126          this.factor = new DecimalType();
5127        this.factor.setValue(value);
5128      }
5129      return this;
5130    }
5131
5132    /**
5133     * @param value A real number that represents a multiplier used in determining
5134     *              the overall value of services delivered and/or goods received.
5135     *              The concept of a Factor allows for a discount or surcharge
5136     *              multiplier to be applied to a monetary amount.
5137     */
5138    public AddedItemSubDetailComponent setFactor(long value) {
5139      this.factor = new DecimalType();
5140      this.factor.setValue(value);
5141      return this;
5142    }
5143
5144    /**
5145     * @param value A real number that represents a multiplier used in determining
5146     *              the overall value of services delivered and/or goods received.
5147     *              The concept of a Factor allows for a discount or surcharge
5148     *              multiplier to be applied to a monetary amount.
5149     */
5150    public AddedItemSubDetailComponent setFactor(double value) {
5151      this.factor = new DecimalType();
5152      this.factor.setValue(value);
5153      return this;
5154    }
5155
5156    /**
5157     * @return {@link #net} (The quantity times the unit price for an additional
5158     *         service or product or charge.)
5159     */
5160    public Money getNet() {
5161      if (this.net == null)
5162        if (Configuration.errorOnAutoCreate())
5163          throw new Error("Attempt to auto-create AddedItemSubDetailComponent.net");
5164        else if (Configuration.doAutoCreate())
5165          this.net = new Money(); // cc
5166      return this.net;
5167    }
5168
5169    public boolean hasNet() {
5170      return this.net != null && !this.net.isEmpty();
5171    }
5172
5173    /**
5174     * @param value {@link #net} (The quantity times the unit price for an
5175     *              additional service or product or charge.)
5176     */
5177    public AddedItemSubDetailComponent setNet(Money value) {
5178      this.net = value;
5179      return this;
5180    }
5181
5182    /**
5183     * @return {@link #noteNumber} (The numbers associated with notes below which
5184     *         apply to the adjudication of this item.)
5185     */
5186    public List<PositiveIntType> getNoteNumber() {
5187      if (this.noteNumber == null)
5188        this.noteNumber = new ArrayList<PositiveIntType>();
5189      return this.noteNumber;
5190    }
5191
5192    /**
5193     * @return Returns a reference to <code>this</code> for easy method chaining
5194     */
5195    public AddedItemSubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) {
5196      this.noteNumber = theNoteNumber;
5197      return this;
5198    }
5199
5200    public boolean hasNoteNumber() {
5201      if (this.noteNumber == null)
5202        return false;
5203      for (PositiveIntType item : this.noteNumber)
5204        if (!item.isEmpty())
5205          return true;
5206      return false;
5207    }
5208
5209    /**
5210     * @return {@link #noteNumber} (The numbers associated with notes below which
5211     *         apply to the adjudication of this item.)
5212     */
5213    public PositiveIntType addNoteNumberElement() {// 2
5214      PositiveIntType t = new PositiveIntType();
5215      if (this.noteNumber == null)
5216        this.noteNumber = new ArrayList<PositiveIntType>();
5217      this.noteNumber.add(t);
5218      return t;
5219    }
5220
5221    /**
5222     * @param value {@link #noteNumber} (The numbers associated with notes below
5223     *              which apply to the adjudication of this item.)
5224     */
5225    public AddedItemSubDetailComponent addNoteNumber(int value) { // 1
5226      PositiveIntType t = new PositiveIntType();
5227      t.setValue(value);
5228      if (this.noteNumber == null)
5229        this.noteNumber = new ArrayList<PositiveIntType>();
5230      this.noteNumber.add(t);
5231      return this;
5232    }
5233
5234    /**
5235     * @param value {@link #noteNumber} (The numbers associated with notes below
5236     *              which apply to the adjudication of this item.)
5237     */
5238    public boolean hasNoteNumber(int value) {
5239      if (this.noteNumber == null)
5240        return false;
5241      for (PositiveIntType v : this.noteNumber)
5242        if (v.getValue().equals(value)) // positiveInt
5243          return true;
5244      return false;
5245    }
5246
5247    /**
5248     * @return {@link #adjudication} (The adjudication results.)
5249     */
5250    public List<AdjudicationComponent> getAdjudication() {
5251      if (this.adjudication == null)
5252        this.adjudication = new ArrayList<AdjudicationComponent>();
5253      return this.adjudication;
5254    }
5255
5256    /**
5257     * @return Returns a reference to <code>this</code> for easy method chaining
5258     */
5259    public AddedItemSubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) {
5260      this.adjudication = theAdjudication;
5261      return this;
5262    }
5263
5264    public boolean hasAdjudication() {
5265      if (this.adjudication == null)
5266        return false;
5267      for (AdjudicationComponent item : this.adjudication)
5268        if (!item.isEmpty())
5269          return true;
5270      return false;
5271    }
5272
5273    public AdjudicationComponent addAdjudication() { // 3
5274      AdjudicationComponent t = new AdjudicationComponent();
5275      if (this.adjudication == null)
5276        this.adjudication = new ArrayList<AdjudicationComponent>();
5277      this.adjudication.add(t);
5278      return t;
5279    }
5280
5281    public AddedItemSubDetailComponent addAdjudication(AdjudicationComponent t) { // 3
5282      if (t == null)
5283        return this;
5284      if (this.adjudication == null)
5285        this.adjudication = new ArrayList<AdjudicationComponent>();
5286      this.adjudication.add(t);
5287      return this;
5288    }
5289
5290    /**
5291     * @return The first repetition of repeating field {@link #adjudication},
5292     *         creating it if it does not already exist
5293     */
5294    public AdjudicationComponent getAdjudicationFirstRep() {
5295      if (getAdjudication().isEmpty()) {
5296        addAdjudication();
5297      }
5298      return getAdjudication().get(0);
5299    }
5300
5301    protected void listChildren(List<Property> children) {
5302      super.listChildren(children);
5303      children.add(new Property("productOrService", "CodeableConcept",
5304          "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.",
5305          0, 1, productOrService));
5306      children.add(new Property("modifier", "CodeableConcept",
5307          "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5308          java.lang.Integer.MAX_VALUE, modifier));
5309      children.add(new Property("quantity", "SimpleQuantity", "The number of repetitions of a service or product.", 0,
5310          1, quantity));
5311      children.add(new Property("unitPrice", "Money",
5312          "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.",
5313          0, 1, unitPrice));
5314      children.add(new Property("factor", "decimal",
5315          "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
5316          0, 1, factor));
5317      children.add(new Property("net", "Money",
5318          "The quantity times the unit price for an additional service or product or charge.", 0, 1, net));
5319      children.add(new Property("noteNumber", "positiveInt",
5320          "The numbers associated with notes below which apply to the adjudication of this item.", 0,
5321          java.lang.Integer.MAX_VALUE, noteNumber));
5322      children.add(new Property("adjudication", "@ClaimResponse.item.adjudication", "The adjudication results.", 0,
5323          java.lang.Integer.MAX_VALUE, adjudication));
5324    }
5325
5326    @Override
5327    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5328      switch (_hash) {
5329      case 1957227299:
5330        /* productOrService */ return new Property("productOrService", "CodeableConcept",
5331            "When the value is a group code then this item collects a set of related claim details, otherwise this contains the product, service, drug or other billing code for the item.",
5332            0, 1, productOrService);
5333      case -615513385:
5334        /* modifier */ return new Property("modifier", "CodeableConcept",
5335            "Item typification or modifiers codes to convey additional context for the product or service.", 0,
5336            java.lang.Integer.MAX_VALUE, modifier);
5337      case -1285004149:
5338        /* quantity */ return new Property("quantity", "SimpleQuantity",
5339            "The number of repetitions of a service or product.", 0, 1, quantity);
5340      case -486196699:
5341        /* unitPrice */ return new Property("unitPrice", "Money",
5342            "If the item is not a group then this is the fee for the product or service, otherwise this is the total of the fees for the details of the group.",
5343            0, 1, unitPrice);
5344      case -1282148017:
5345        /* factor */ return new Property("factor", "decimal",
5346            "A real number that represents a multiplier used in determining the overall value of services delivered and/or goods received. The concept of a Factor allows for a discount or surcharge multiplier to be applied to a monetary amount.",
5347            0, 1, factor);
5348      case 108957:
5349        /* net */ return new Property("net", "Money",
5350            "The quantity times the unit price for an additional service or product or charge.", 0, 1, net);
5351      case -1110033957:
5352        /* noteNumber */ return new Property("noteNumber", "positiveInt",
5353            "The numbers associated with notes below which apply to the adjudication of this item.", 0,
5354            java.lang.Integer.MAX_VALUE, noteNumber);
5355      case -231349275:
5356        /* adjudication */ return new Property("adjudication", "@ClaimResponse.item.adjudication",
5357            "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication);
5358      default:
5359        return super.getNamedProperty(_hash, _name, _checkValid);
5360      }
5361
5362    }
5363
5364    @Override
5365    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5366      switch (hash) {
5367      case 1957227299:
5368        /* productOrService */ return this.productOrService == null ? new Base[0]
5369            : new Base[] { this.productOrService }; // CodeableConcept
5370      case -615513385:
5371        /* modifier */ return this.modifier == null ? new Base[0]
5372            : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
5373      case -1285004149:
5374        /* quantity */ return this.quantity == null ? new Base[0] : new Base[] { this.quantity }; // Quantity
5375      case -486196699:
5376        /* unitPrice */ return this.unitPrice == null ? new Base[0] : new Base[] { this.unitPrice }; // Money
5377      case -1282148017:
5378        /* factor */ return this.factor == null ? new Base[0] : new Base[] { this.factor }; // DecimalType
5379      case 108957:
5380        /* net */ return this.net == null ? new Base[0] : new Base[] { this.net }; // Money
5381      case -1110033957:
5382        /* noteNumber */ return this.noteNumber == null ? new Base[0]
5383            : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
5384      case -231349275:
5385        /* adjudication */ return this.adjudication == null ? new Base[0]
5386            : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
5387      default:
5388        return super.getProperty(hash, name, checkValid);
5389      }
5390
5391    }
5392
5393    @Override
5394    public Base setProperty(int hash, String name, Base value) throws FHIRException {
5395      switch (hash) {
5396      case 1957227299: // productOrService
5397        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5398        return value;
5399      case -615513385: // modifier
5400        this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
5401        return value;
5402      case -1285004149: // quantity
5403        this.quantity = castToQuantity(value); // Quantity
5404        return value;
5405      case -486196699: // unitPrice
5406        this.unitPrice = castToMoney(value); // Money
5407        return value;
5408      case -1282148017: // factor
5409        this.factor = castToDecimal(value); // DecimalType
5410        return value;
5411      case 108957: // net
5412        this.net = castToMoney(value); // Money
5413        return value;
5414      case -1110033957: // noteNumber
5415        this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
5416        return value;
5417      case -231349275: // adjudication
5418        this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
5419        return value;
5420      default:
5421        return super.setProperty(hash, name, value);
5422      }
5423
5424    }
5425
5426    @Override
5427    public Base setProperty(String name, Base value) throws FHIRException {
5428      if (name.equals("productOrService")) {
5429        this.productOrService = castToCodeableConcept(value); // CodeableConcept
5430      } else if (name.equals("modifier")) {
5431        this.getModifier().add(castToCodeableConcept(value));
5432      } else if (name.equals("quantity")) {
5433        this.quantity = castToQuantity(value); // Quantity
5434      } else if (name.equals("unitPrice")) {
5435        this.unitPrice = castToMoney(value); // Money
5436      } else if (name.equals("factor")) {
5437        this.factor = castToDecimal(value); // DecimalType
5438      } else if (name.equals("net")) {
5439        this.net = castToMoney(value); // Money
5440      } else if (name.equals("noteNumber")) {
5441        this.getNoteNumber().add(castToPositiveInt(value));
5442      } else if (name.equals("adjudication")) {
5443        this.getAdjudication().add((AdjudicationComponent) value);
5444      } else
5445        return super.setProperty(name, value);
5446      return value;
5447    }
5448
5449    @Override
5450    public Base makeProperty(int hash, String name) throws FHIRException {
5451      switch (hash) {
5452      case 1957227299:
5453        return getProductOrService();
5454      case -615513385:
5455        return addModifier();
5456      case -1285004149:
5457        return getQuantity();
5458      case -486196699:
5459        return getUnitPrice();
5460      case -1282148017:
5461        return getFactorElement();
5462      case 108957:
5463        return getNet();
5464      case -1110033957:
5465        return addNoteNumberElement();
5466      case -231349275:
5467        return addAdjudication();
5468      default:
5469        return super.makeProperty(hash, name);
5470      }
5471
5472    }
5473
5474    @Override
5475    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5476      switch (hash) {
5477      case 1957227299:
5478        /* productOrService */ return new String[] { "CodeableConcept" };
5479      case -615513385:
5480        /* modifier */ return new String[] { "CodeableConcept" };
5481      case -1285004149:
5482        /* quantity */ return new String[] { "SimpleQuantity" };
5483      case -486196699:
5484        /* unitPrice */ return new String[] { "Money" };
5485      case -1282148017:
5486        /* factor */ return new String[] { "decimal" };
5487      case 108957:
5488        /* net */ return new String[] { "Money" };
5489      case -1110033957:
5490        /* noteNumber */ return new String[] { "positiveInt" };
5491      case -231349275:
5492        /* adjudication */ return new String[] { "@ClaimResponse.item.adjudication" };
5493      default:
5494        return super.getTypesForProperty(hash, name);
5495      }
5496
5497    }
5498
5499    @Override
5500    public Base addChild(String name) throws FHIRException {
5501      if (name.equals("productOrService")) {
5502        this.productOrService = new CodeableConcept();
5503        return this.productOrService;
5504      } else if (name.equals("modifier")) {
5505        return addModifier();
5506      } else if (name.equals("quantity")) {
5507        this.quantity = new Quantity();
5508        return this.quantity;
5509      } else if (name.equals("unitPrice")) {
5510        this.unitPrice = new Money();
5511        return this.unitPrice;
5512      } else if (name.equals("factor")) {
5513        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.factor");
5514      } else if (name.equals("net")) {
5515        this.net = new Money();
5516        return this.net;
5517      } else if (name.equals("noteNumber")) {
5518        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.noteNumber");
5519      } else if (name.equals("adjudication")) {
5520        return addAdjudication();
5521      } else
5522        return super.addChild(name);
5523    }
5524
5525    public AddedItemSubDetailComponent copy() {
5526      AddedItemSubDetailComponent dst = new AddedItemSubDetailComponent();
5527      copyValues(dst);
5528      return dst;
5529    }
5530
5531    public void copyValues(AddedItemSubDetailComponent dst) {
5532      super.copyValues(dst);
5533      dst.productOrService = productOrService == null ? null : productOrService.copy();
5534      if (modifier != null) {
5535        dst.modifier = new ArrayList<CodeableConcept>();
5536        for (CodeableConcept i : modifier)
5537          dst.modifier.add(i.copy());
5538      }
5539      ;
5540      dst.quantity = quantity == null ? null : quantity.copy();
5541      dst.unitPrice = unitPrice == null ? null : unitPrice.copy();
5542      dst.factor = factor == null ? null : factor.copy();
5543      dst.net = net == null ? null : net.copy();
5544      if (noteNumber != null) {
5545        dst.noteNumber = new ArrayList<PositiveIntType>();
5546        for (PositiveIntType i : noteNumber)
5547          dst.noteNumber.add(i.copy());
5548      }
5549      ;
5550      if (adjudication != null) {
5551        dst.adjudication = new ArrayList<AdjudicationComponent>();
5552        for (AdjudicationComponent i : adjudication)
5553          dst.adjudication.add(i.copy());
5554      }
5555      ;
5556    }
5557
5558    @Override
5559    public boolean equalsDeep(Base other_) {
5560      if (!super.equalsDeep(other_))
5561        return false;
5562      if (!(other_ instanceof AddedItemSubDetailComponent))
5563        return false;
5564      AddedItemSubDetailComponent o = (AddedItemSubDetailComponent) other_;
5565      return compareDeep(productOrService, o.productOrService, true) && compareDeep(modifier, o.modifier, true)
5566          && compareDeep(quantity, o.quantity, true) && compareDeep(unitPrice, o.unitPrice, true)
5567          && compareDeep(factor, o.factor, true) && compareDeep(net, o.net, true)
5568          && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true);
5569    }
5570
5571    @Override
5572    public boolean equalsShallow(Base other_) {
5573      if (!super.equalsShallow(other_))
5574        return false;
5575      if (!(other_ instanceof AddedItemSubDetailComponent))
5576        return false;
5577      AddedItemSubDetailComponent o = (AddedItemSubDetailComponent) other_;
5578      return compareValues(factor, o.factor, true) && compareValues(noteNumber, o.noteNumber, true);
5579    }
5580
5581    public boolean isEmpty() {
5582      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(productOrService, modifier, quantity, unitPrice,
5583          factor, net, noteNumber, adjudication);
5584    }
5585
5586    public String fhirType() {
5587      return "ClaimResponse.addItem.detail.subDetail";
5588
5589    }
5590
5591  }
5592
5593  @Block()
5594  public static class TotalComponent extends BackboneElement implements IBaseBackboneElement {
5595    /**
5596     * A code to indicate the information type of this adjudication record.
5597     * Information types may include: the value submitted, maximum values or
5598     * percentages allowed or payable under the plan, amounts that the patient is
5599     * responsible for in aggregate or pertaining to this item, amounts paid by
5600     * other coverages, and the benefit payable for this item.
5601     */
5602    @Child(name = "category", type = {
5603        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = true)
5604    @Description(shortDefinition = "Type of adjudication information", formalDefinition = "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.")
5605    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication")
5606    protected CodeableConcept category;
5607
5608    /**
5609     * Monetary total amount associated with the category.
5610     */
5611    @Child(name = "amount", type = { Money.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
5612    @Description(shortDefinition = "Financial total for the category", formalDefinition = "Monetary total amount associated with the category.")
5613    protected Money amount;
5614
5615    private static final long serialVersionUID = 2012310309L;
5616
5617    /**
5618     * Constructor
5619     */
5620    public TotalComponent() {
5621      super();
5622    }
5623
5624    /**
5625     * Constructor
5626     */
5627    public TotalComponent(CodeableConcept category, Money amount) {
5628      super();
5629      this.category = category;
5630      this.amount = amount;
5631    }
5632
5633    /**
5634     * @return {@link #category} (A code to indicate the information type of this
5635     *         adjudication record. Information types may include: the value
5636     *         submitted, maximum values or percentages allowed or payable under the
5637     *         plan, amounts that the patient is responsible for in aggregate or
5638     *         pertaining to this item, amounts paid by other coverages, and the
5639     *         benefit payable for this item.)
5640     */
5641    public CodeableConcept getCategory() {
5642      if (this.category == null)
5643        if (Configuration.errorOnAutoCreate())
5644          throw new Error("Attempt to auto-create TotalComponent.category");
5645        else if (Configuration.doAutoCreate())
5646          this.category = new CodeableConcept(); // cc
5647      return this.category;
5648    }
5649
5650    public boolean hasCategory() {
5651      return this.category != null && !this.category.isEmpty();
5652    }
5653
5654    /**
5655     * @param value {@link #category} (A code to indicate the information type of
5656     *              this adjudication record. Information types may include: the
5657     *              value submitted, maximum values or percentages allowed or
5658     *              payable under the plan, amounts that the patient is responsible
5659     *              for in aggregate or pertaining to this item, amounts paid by
5660     *              other coverages, and the benefit payable for this item.)
5661     */
5662    public TotalComponent setCategory(CodeableConcept value) {
5663      this.category = value;
5664      return this;
5665    }
5666
5667    /**
5668     * @return {@link #amount} (Monetary total amount associated with the category.)
5669     */
5670    public Money getAmount() {
5671      if (this.amount == null)
5672        if (Configuration.errorOnAutoCreate())
5673          throw new Error("Attempt to auto-create TotalComponent.amount");
5674        else if (Configuration.doAutoCreate())
5675          this.amount = new Money(); // cc
5676      return this.amount;
5677    }
5678
5679    public boolean hasAmount() {
5680      return this.amount != null && !this.amount.isEmpty();
5681    }
5682
5683    /**
5684     * @param value {@link #amount} (Monetary total amount associated with the
5685     *              category.)
5686     */
5687    public TotalComponent setAmount(Money value) {
5688      this.amount = value;
5689      return this;
5690    }
5691
5692    protected void listChildren(List<Property> children) {
5693      super.listChildren(children);
5694      children.add(new Property("category", "CodeableConcept",
5695          "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.",
5696          0, 1, category));
5697      children
5698          .add(new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1, amount));
5699    }
5700
5701    @Override
5702    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
5703      switch (_hash) {
5704      case 50511102:
5705        /* category */ return new Property("category", "CodeableConcept",
5706            "A code to indicate the information type of this adjudication record. Information types may include: the value submitted, maximum values or percentages allowed or payable under the plan, amounts that the patient is responsible for in aggregate or pertaining to this item, amounts paid by other coverages, and the benefit payable for this item.",
5707            0, 1, category);
5708      case -1413853096:
5709        /* amount */ return new Property("amount", "Money", "Monetary total amount associated with the category.", 0, 1,
5710            amount);
5711      default:
5712        return super.getNamedProperty(_hash, _name, _checkValid);
5713      }
5714
5715    }
5716
5717    @Override
5718    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5719      switch (hash) {
5720      case 50511102:
5721        /* category */ return this.category == null ? new Base[0] : new Base[] { this.category }; // CodeableConcept
5722      case -1413853096:
5723        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
5724      default:
5725        return super.getProperty(hash, name, checkValid);
5726      }
5727
5728    }
5729
5730    @Override
5731    public Base setProperty(int hash, String name, Base value) throws FHIRException {
5732      switch (hash) {
5733      case 50511102: // category
5734        this.category = castToCodeableConcept(value); // CodeableConcept
5735        return value;
5736      case -1413853096: // amount
5737        this.amount = castToMoney(value); // Money
5738        return value;
5739      default:
5740        return super.setProperty(hash, name, value);
5741      }
5742
5743    }
5744
5745    @Override
5746    public Base setProperty(String name, Base value) throws FHIRException {
5747      if (name.equals("category")) {
5748        this.category = castToCodeableConcept(value); // CodeableConcept
5749      } else if (name.equals("amount")) {
5750        this.amount = castToMoney(value); // Money
5751      } else
5752        return super.setProperty(name, value);
5753      return value;
5754    }
5755
5756    @Override
5757    public Base makeProperty(int hash, String name) throws FHIRException {
5758      switch (hash) {
5759      case 50511102:
5760        return getCategory();
5761      case -1413853096:
5762        return getAmount();
5763      default:
5764        return super.makeProperty(hash, name);
5765      }
5766
5767    }
5768
5769    @Override
5770    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5771      switch (hash) {
5772      case 50511102:
5773        /* category */ return new String[] { "CodeableConcept" };
5774      case -1413853096:
5775        /* amount */ return new String[] { "Money" };
5776      default:
5777        return super.getTypesForProperty(hash, name);
5778      }
5779
5780    }
5781
5782    @Override
5783    public Base addChild(String name) throws FHIRException {
5784      if (name.equals("category")) {
5785        this.category = new CodeableConcept();
5786        return this.category;
5787      } else if (name.equals("amount")) {
5788        this.amount = new Money();
5789        return this.amount;
5790      } else
5791        return super.addChild(name);
5792    }
5793
5794    public TotalComponent copy() {
5795      TotalComponent dst = new TotalComponent();
5796      copyValues(dst);
5797      return dst;
5798    }
5799
5800    public void copyValues(TotalComponent dst) {
5801      super.copyValues(dst);
5802      dst.category = category == null ? null : category.copy();
5803      dst.amount = amount == null ? null : amount.copy();
5804    }
5805
5806    @Override
5807    public boolean equalsDeep(Base other_) {
5808      if (!super.equalsDeep(other_))
5809        return false;
5810      if (!(other_ instanceof TotalComponent))
5811        return false;
5812      TotalComponent o = (TotalComponent) other_;
5813      return compareDeep(category, o.category, true) && compareDeep(amount, o.amount, true);
5814    }
5815
5816    @Override
5817    public boolean equalsShallow(Base other_) {
5818      if (!super.equalsShallow(other_))
5819        return false;
5820      if (!(other_ instanceof TotalComponent))
5821        return false;
5822      TotalComponent o = (TotalComponent) other_;
5823      return true;
5824    }
5825
5826    public boolean isEmpty() {
5827      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, amount);
5828    }
5829
5830    public String fhirType() {
5831      return "ClaimResponse.total";
5832
5833    }
5834
5835  }
5836
5837  @Block()
5838  public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
5839    /**
5840     * Whether this represents partial or complete payment of the benefits payable.
5841     */
5842    @Child(name = "type", type = {
5843        CodeableConcept.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
5844    @Description(shortDefinition = "Partial or complete payment", formalDefinition = "Whether this represents partial or complete payment of the benefits payable.")
5845    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/ex-paymenttype")
5846    protected CodeableConcept type;
5847
5848    /**
5849     * Total amount of all adjustments to this payment included in this transaction
5850     * which are not related to this claim's adjudication.
5851     */
5852    @Child(name = "adjustment", type = { Money.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
5853    @Description(shortDefinition = "Payment adjustment for non-claim issues", formalDefinition = "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.")
5854    protected Money adjustment;
5855
5856    /**
5857     * Reason for the payment adjustment.
5858     */
5859    @Child(name = "adjustmentReason", type = {
5860        CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
5861    @Description(shortDefinition = "Explanation for the adjustment", formalDefinition = "Reason for the payment adjustment.")
5862    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
5863    protected CodeableConcept adjustmentReason;
5864
5865    /**
5866     * Estimated date the payment will be issued or the actual issue date of
5867     * payment.
5868     */
5869    @Child(name = "date", type = { DateType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
5870    @Description(shortDefinition = "Expected date of payment", formalDefinition = "Estimated date the payment will be issued or the actual issue date of payment.")
5871    protected DateType date;
5872
5873    /**
5874     * Benefits payable less any payment adjustment.
5875     */
5876    @Child(name = "amount", type = { Money.class }, order = 5, min = 1, max = 1, modifier = false, summary = false)
5877    @Description(shortDefinition = "Payable amount after adjustment", formalDefinition = "Benefits payable less any payment adjustment.")
5878    protected Money amount;
5879
5880    /**
5881     * Issuer's unique identifier for the payment instrument.
5882     */
5883    @Child(name = "identifier", type = {
5884        Identifier.class }, order = 6, min = 0, max = 1, modifier = false, summary = false)
5885    @Description(shortDefinition = "Business identifier for the payment", formalDefinition = "Issuer's unique identifier for the payment instrument.")
5886    protected Identifier identifier;
5887
5888    private static final long serialVersionUID = 1539906026L;
5889
5890    /**
5891     * Constructor
5892     */
5893    public PaymentComponent() {
5894      super();
5895    }
5896
5897    /**
5898     * Constructor
5899     */
5900    public PaymentComponent(CodeableConcept type, Money amount) {
5901      super();
5902      this.type = type;
5903      this.amount = amount;
5904    }
5905
5906    /**
5907     * @return {@link #type} (Whether this represents partial or complete payment of
5908     *         the benefits payable.)
5909     */
5910    public CodeableConcept getType() {
5911      if (this.type == null)
5912        if (Configuration.errorOnAutoCreate())
5913          throw new Error("Attempt to auto-create PaymentComponent.type");
5914        else if (Configuration.doAutoCreate())
5915          this.type = new CodeableConcept(); // cc
5916      return this.type;
5917    }
5918
5919    public boolean hasType() {
5920      return this.type != null && !this.type.isEmpty();
5921    }
5922
5923    /**
5924     * @param value {@link #type} (Whether this represents partial or complete
5925     *              payment of the benefits payable.)
5926     */
5927    public PaymentComponent setType(CodeableConcept value) {
5928      this.type = value;
5929      return this;
5930    }
5931
5932    /**
5933     * @return {@link #adjustment} (Total amount of all adjustments to this payment
5934     *         included in this transaction which are not related to this claim's
5935     *         adjudication.)
5936     */
5937    public Money getAdjustment() {
5938      if (this.adjustment == null)
5939        if (Configuration.errorOnAutoCreate())
5940          throw new Error("Attempt to auto-create PaymentComponent.adjustment");
5941        else if (Configuration.doAutoCreate())
5942          this.adjustment = new Money(); // cc
5943      return this.adjustment;
5944    }
5945
5946    public boolean hasAdjustment() {
5947      return this.adjustment != null && !this.adjustment.isEmpty();
5948    }
5949
5950    /**
5951     * @param value {@link #adjustment} (Total amount of all adjustments to this
5952     *              payment included in this transaction which are not related to
5953     *              this claim's adjudication.)
5954     */
5955    public PaymentComponent setAdjustment(Money value) {
5956      this.adjustment = value;
5957      return this;
5958    }
5959
5960    /**
5961     * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
5962     */
5963    public CodeableConcept getAdjustmentReason() {
5964      if (this.adjustmentReason == null)
5965        if (Configuration.errorOnAutoCreate())
5966          throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
5967        else if (Configuration.doAutoCreate())
5968          this.adjustmentReason = new CodeableConcept(); // cc
5969      return this.adjustmentReason;
5970    }
5971
5972    public boolean hasAdjustmentReason() {
5973      return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
5974    }
5975
5976    /**
5977     * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
5978     */
5979    public PaymentComponent setAdjustmentReason(CodeableConcept value) {
5980      this.adjustmentReason = value;
5981      return this;
5982    }
5983
5984    /**
5985     * @return {@link #date} (Estimated date the payment will be issued or the
5986     *         actual issue date of payment.). This is the underlying object with
5987     *         id, value and extensions. The accessor "getDate" gives direct access
5988     *         to the value
5989     */
5990    public DateType getDateElement() {
5991      if (this.date == null)
5992        if (Configuration.errorOnAutoCreate())
5993          throw new Error("Attempt to auto-create PaymentComponent.date");
5994        else if (Configuration.doAutoCreate())
5995          this.date = new DateType(); // bb
5996      return this.date;
5997    }
5998
5999    public boolean hasDateElement() {
6000      return this.date != null && !this.date.isEmpty();
6001    }
6002
6003    public boolean hasDate() {
6004      return this.date != null && !this.date.isEmpty();
6005    }
6006
6007    /**
6008     * @param value {@link #date} (Estimated date the payment will be issued or the
6009     *              actual issue date of payment.). This is the underlying object
6010     *              with id, value and extensions. The accessor "getDate" gives
6011     *              direct access to the value
6012     */
6013    public PaymentComponent setDateElement(DateType value) {
6014      this.date = value;
6015      return this;
6016    }
6017
6018    /**
6019     * @return Estimated date the payment will be issued or the actual issue date of
6020     *         payment.
6021     */
6022    public Date getDate() {
6023      return this.date == null ? null : this.date.getValue();
6024    }
6025
6026    /**
6027     * @param value Estimated date the payment will be issued or the actual issue
6028     *              date of payment.
6029     */
6030    public PaymentComponent setDate(Date value) {
6031      if (value == null)
6032        this.date = null;
6033      else {
6034        if (this.date == null)
6035          this.date = new DateType();
6036        this.date.setValue(value);
6037      }
6038      return this;
6039    }
6040
6041    /**
6042     * @return {@link #amount} (Benefits payable less any payment adjustment.)
6043     */
6044    public Money getAmount() {
6045      if (this.amount == null)
6046        if (Configuration.errorOnAutoCreate())
6047          throw new Error("Attempt to auto-create PaymentComponent.amount");
6048        else if (Configuration.doAutoCreate())
6049          this.amount = new Money(); // cc
6050      return this.amount;
6051    }
6052
6053    public boolean hasAmount() {
6054      return this.amount != null && !this.amount.isEmpty();
6055    }
6056
6057    /**
6058     * @param value {@link #amount} (Benefits payable less any payment adjustment.)
6059     */
6060    public PaymentComponent setAmount(Money value) {
6061      this.amount = value;
6062      return this;
6063    }
6064
6065    /**
6066     * @return {@link #identifier} (Issuer's unique identifier for the payment
6067     *         instrument.)
6068     */
6069    public Identifier getIdentifier() {
6070      if (this.identifier == null)
6071        if (Configuration.errorOnAutoCreate())
6072          throw new Error("Attempt to auto-create PaymentComponent.identifier");
6073        else if (Configuration.doAutoCreate())
6074          this.identifier = new Identifier(); // cc
6075      return this.identifier;
6076    }
6077
6078    public boolean hasIdentifier() {
6079      return this.identifier != null && !this.identifier.isEmpty();
6080    }
6081
6082    /**
6083     * @param value {@link #identifier} (Issuer's unique identifier for the payment
6084     *              instrument.)
6085     */
6086    public PaymentComponent setIdentifier(Identifier value) {
6087      this.identifier = value;
6088      return this;
6089    }
6090
6091    protected void listChildren(List<Property> children) {
6092      super.listChildren(children);
6093      children.add(new Property("type", "CodeableConcept",
6094          "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type));
6095      children.add(new Property("adjustment", "Money",
6096          "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.",
6097          0, 1, adjustment));
6098      children.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, 1,
6099          adjustmentReason));
6100      children.add(new Property("date", "date",
6101          "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date));
6102      children.add(new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1, amount));
6103      children.add(new Property("identifier", "Identifier", "Issuer's unique identifier for the payment instrument.", 0,
6104          1, identifier));
6105    }
6106
6107    @Override
6108    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6109      switch (_hash) {
6110      case 3575610:
6111        /* type */ return new Property("type", "CodeableConcept",
6112            "Whether this represents partial or complete payment of the benefits payable.", 0, 1, type);
6113      case 1977085293:
6114        /* adjustment */ return new Property("adjustment", "Money",
6115            "Total amount of all adjustments to this payment included in this transaction which are not related to this claim's adjudication.",
6116            0, 1, adjustment);
6117      case -1255938543:
6118        /* adjustmentReason */ return new Property("adjustmentReason", "CodeableConcept",
6119            "Reason for the payment adjustment.", 0, 1, adjustmentReason);
6120      case 3076014:
6121        /* date */ return new Property("date", "date",
6122            "Estimated date the payment will be issued or the actual issue date of payment.", 0, 1, date);
6123      case -1413853096:
6124        /* amount */ return new Property("amount", "Money", "Benefits payable less any payment adjustment.", 0, 1,
6125            amount);
6126      case -1618432855:
6127        /* identifier */ return new Property("identifier", "Identifier",
6128            "Issuer's unique identifier for the payment instrument.", 0, 1, identifier);
6129      default:
6130        return super.getNamedProperty(_hash, _name, _checkValid);
6131      }
6132
6133    }
6134
6135    @Override
6136    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6137      switch (hash) {
6138      case 3575610:
6139        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
6140      case 1977085293:
6141        /* adjustment */ return this.adjustment == null ? new Base[0] : new Base[] { this.adjustment }; // Money
6142      case -1255938543:
6143        /* adjustmentReason */ return this.adjustmentReason == null ? new Base[0]
6144            : new Base[] { this.adjustmentReason }; // CodeableConcept
6145      case 3076014:
6146        /* date */ return this.date == null ? new Base[0] : new Base[] { this.date }; // DateType
6147      case -1413853096:
6148        /* amount */ return this.amount == null ? new Base[0] : new Base[] { this.amount }; // Money
6149      case -1618432855:
6150        /* identifier */ return this.identifier == null ? new Base[0] : new Base[] { this.identifier }; // Identifier
6151      default:
6152        return super.getProperty(hash, name, checkValid);
6153      }
6154
6155    }
6156
6157    @Override
6158    public Base setProperty(int hash, String name, Base value) throws FHIRException {
6159      switch (hash) {
6160      case 3575610: // type
6161        this.type = castToCodeableConcept(value); // CodeableConcept
6162        return value;
6163      case 1977085293: // adjustment
6164        this.adjustment = castToMoney(value); // Money
6165        return value;
6166      case -1255938543: // adjustmentReason
6167        this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
6168        return value;
6169      case 3076014: // date
6170        this.date = castToDate(value); // DateType
6171        return value;
6172      case -1413853096: // amount
6173        this.amount = castToMoney(value); // Money
6174        return value;
6175      case -1618432855: // identifier
6176        this.identifier = castToIdentifier(value); // Identifier
6177        return value;
6178      default:
6179        return super.setProperty(hash, name, value);
6180      }
6181
6182    }
6183
6184    @Override
6185    public Base setProperty(String name, Base value) throws FHIRException {
6186      if (name.equals("type")) {
6187        this.type = castToCodeableConcept(value); // CodeableConcept
6188      } else if (name.equals("adjustment")) {
6189        this.adjustment = castToMoney(value); // Money
6190      } else if (name.equals("adjustmentReason")) {
6191        this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
6192      } else if (name.equals("date")) {
6193        this.date = castToDate(value); // DateType
6194      } else if (name.equals("amount")) {
6195        this.amount = castToMoney(value); // Money
6196      } else if (name.equals("identifier")) {
6197        this.identifier = castToIdentifier(value); // Identifier
6198      } else
6199        return super.setProperty(name, value);
6200      return value;
6201    }
6202
6203    @Override
6204    public Base makeProperty(int hash, String name) throws FHIRException {
6205      switch (hash) {
6206      case 3575610:
6207        return getType();
6208      case 1977085293:
6209        return getAdjustment();
6210      case -1255938543:
6211        return getAdjustmentReason();
6212      case 3076014:
6213        return getDateElement();
6214      case -1413853096:
6215        return getAmount();
6216      case -1618432855:
6217        return getIdentifier();
6218      default:
6219        return super.makeProperty(hash, name);
6220      }
6221
6222    }
6223
6224    @Override
6225    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6226      switch (hash) {
6227      case 3575610:
6228        /* type */ return new String[] { "CodeableConcept" };
6229      case 1977085293:
6230        /* adjustment */ return new String[] { "Money" };
6231      case -1255938543:
6232        /* adjustmentReason */ return new String[] { "CodeableConcept" };
6233      case 3076014:
6234        /* date */ return new String[] { "date" };
6235      case -1413853096:
6236        /* amount */ return new String[] { "Money" };
6237      case -1618432855:
6238        /* identifier */ return new String[] { "Identifier" };
6239      default:
6240        return super.getTypesForProperty(hash, name);
6241      }
6242
6243    }
6244
6245    @Override
6246    public Base addChild(String name) throws FHIRException {
6247      if (name.equals("type")) {
6248        this.type = new CodeableConcept();
6249        return this.type;
6250      } else if (name.equals("adjustment")) {
6251        this.adjustment = new Money();
6252        return this.adjustment;
6253      } else if (name.equals("adjustmentReason")) {
6254        this.adjustmentReason = new CodeableConcept();
6255        return this.adjustmentReason;
6256      } else if (name.equals("date")) {
6257        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.date");
6258      } else if (name.equals("amount")) {
6259        this.amount = new Money();
6260        return this.amount;
6261      } else if (name.equals("identifier")) {
6262        this.identifier = new Identifier();
6263        return this.identifier;
6264      } else
6265        return super.addChild(name);
6266    }
6267
6268    public PaymentComponent copy() {
6269      PaymentComponent dst = new PaymentComponent();
6270      copyValues(dst);
6271      return dst;
6272    }
6273
6274    public void copyValues(PaymentComponent dst) {
6275      super.copyValues(dst);
6276      dst.type = type == null ? null : type.copy();
6277      dst.adjustment = adjustment == null ? null : adjustment.copy();
6278      dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
6279      dst.date = date == null ? null : date.copy();
6280      dst.amount = amount == null ? null : amount.copy();
6281      dst.identifier = identifier == null ? null : identifier.copy();
6282    }
6283
6284    @Override
6285    public boolean equalsDeep(Base other_) {
6286      if (!super.equalsDeep(other_))
6287        return false;
6288      if (!(other_ instanceof PaymentComponent))
6289        return false;
6290      PaymentComponent o = (PaymentComponent) other_;
6291      return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true)
6292          && compareDeep(adjustmentReason, o.adjustmentReason, true) && compareDeep(date, o.date, true)
6293          && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true);
6294    }
6295
6296    @Override
6297    public boolean equalsShallow(Base other_) {
6298      if (!super.equalsShallow(other_))
6299        return false;
6300      if (!(other_ instanceof PaymentComponent))
6301        return false;
6302      PaymentComponent o = (PaymentComponent) other_;
6303      return compareValues(date, o.date, true);
6304    }
6305
6306    public boolean isEmpty() {
6307      return super.isEmpty()
6308          && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason, date, amount, identifier);
6309    }
6310
6311    public String fhirType() {
6312      return "ClaimResponse.payment";
6313
6314    }
6315
6316  }
6317
6318  @Block()
6319  public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
6320    /**
6321     * A number to uniquely identify a note entry.
6322     */
6323    @Child(name = "number", type = {
6324        PositiveIntType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
6325    @Description(shortDefinition = "Note instance identifier", formalDefinition = "A number to uniquely identify a note entry.")
6326    protected PositiveIntType number;
6327
6328    /**
6329     * The business purpose of the note text.
6330     */
6331    @Child(name = "type", type = { CodeType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
6332    @Description(shortDefinition = "display | print | printoper", formalDefinition = "The business purpose of the note text.")
6333    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/note-type")
6334    protected Enumeration<NoteType> type;
6335
6336    /**
6337     * The explanation or description associated with the processing.
6338     */
6339    @Child(name = "text", type = { StringType.class }, order = 3, min = 1, max = 1, modifier = false, summary = false)
6340    @Description(shortDefinition = "Note explanatory text", formalDefinition = "The explanation or description associated with the processing.")
6341    protected StringType text;
6342
6343    /**
6344     * A code to define the language used in the text of the note.
6345     */
6346    @Child(name = "language", type = {
6347        CodeableConcept.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
6348    @Description(shortDefinition = "Language of the text", formalDefinition = "A code to define the language used in the text of the note.")
6349    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/languages")
6350    protected CodeableConcept language;
6351
6352    private static final long serialVersionUID = -385184277L;
6353
6354    /**
6355     * Constructor
6356     */
6357    public NoteComponent() {
6358      super();
6359    }
6360
6361    /**
6362     * Constructor
6363     */
6364    public NoteComponent(StringType text) {
6365      super();
6366      this.text = text;
6367    }
6368
6369    /**
6370     * @return {@link #number} (A number to uniquely identify a note entry.). This
6371     *         is the underlying object with id, value and extensions. The accessor
6372     *         "getNumber" gives direct access to the value
6373     */
6374    public PositiveIntType getNumberElement() {
6375      if (this.number == null)
6376        if (Configuration.errorOnAutoCreate())
6377          throw new Error("Attempt to auto-create NoteComponent.number");
6378        else if (Configuration.doAutoCreate())
6379          this.number = new PositiveIntType(); // bb
6380      return this.number;
6381    }
6382
6383    public boolean hasNumberElement() {
6384      return this.number != null && !this.number.isEmpty();
6385    }
6386
6387    public boolean hasNumber() {
6388      return this.number != null && !this.number.isEmpty();
6389    }
6390
6391    /**
6392     * @param value {@link #number} (A number to uniquely identify a note entry.).
6393     *              This is the underlying object with id, value and extensions. The
6394     *              accessor "getNumber" gives direct access to the value
6395     */
6396    public NoteComponent setNumberElement(PositiveIntType value) {
6397      this.number = value;
6398      return this;
6399    }
6400
6401    /**
6402     * @return A number to uniquely identify a note entry.
6403     */
6404    public int getNumber() {
6405      return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
6406    }
6407
6408    /**
6409     * @param value A number to uniquely identify a note entry.
6410     */
6411    public NoteComponent setNumber(int value) {
6412      if (this.number == null)
6413        this.number = new PositiveIntType();
6414      this.number.setValue(value);
6415      return this;
6416    }
6417
6418    /**
6419     * @return {@link #type} (The business purpose of the note text.). This is the
6420     *         underlying object with id, value and extensions. The accessor
6421     *         "getType" gives direct access to the value
6422     */
6423    public Enumeration<NoteType> getTypeElement() {
6424      if (this.type == null)
6425        if (Configuration.errorOnAutoCreate())
6426          throw new Error("Attempt to auto-create NoteComponent.type");
6427        else if (Configuration.doAutoCreate())
6428          this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory()); // bb
6429      return this.type;
6430    }
6431
6432    public boolean hasTypeElement() {
6433      return this.type != null && !this.type.isEmpty();
6434    }
6435
6436    public boolean hasType() {
6437      return this.type != null && !this.type.isEmpty();
6438    }
6439
6440    /**
6441     * @param value {@link #type} (The business purpose of the note text.). This is
6442     *              the underlying object with id, value and extensions. The
6443     *              accessor "getType" gives direct access to the value
6444     */
6445    public NoteComponent setTypeElement(Enumeration<NoteType> value) {
6446      this.type = value;
6447      return this;
6448    }
6449
6450    /**
6451     * @return The business purpose of the note text.
6452     */
6453    public NoteType getType() {
6454      return this.type == null ? null : this.type.getValue();
6455    }
6456
6457    /**
6458     * @param value The business purpose of the note text.
6459     */
6460    public NoteComponent setType(NoteType value) {
6461      if (value == null)
6462        this.type = null;
6463      else {
6464        if (this.type == null)
6465          this.type = new Enumeration<NoteType>(new NoteTypeEnumFactory());
6466        this.type.setValue(value);
6467      }
6468      return this;
6469    }
6470
6471    /**
6472     * @return {@link #text} (The explanation or description associated with the
6473     *         processing.). This is the underlying object with id, value and
6474     *         extensions. The accessor "getText" gives direct access to the value
6475     */
6476    public StringType getTextElement() {
6477      if (this.text == null)
6478        if (Configuration.errorOnAutoCreate())
6479          throw new Error("Attempt to auto-create NoteComponent.text");
6480        else if (Configuration.doAutoCreate())
6481          this.text = new StringType(); // bb
6482      return this.text;
6483    }
6484
6485    public boolean hasTextElement() {
6486      return this.text != null && !this.text.isEmpty();
6487    }
6488
6489    public boolean hasText() {
6490      return this.text != null && !this.text.isEmpty();
6491    }
6492
6493    /**
6494     * @param value {@link #text} (The explanation or description associated with
6495     *              the processing.). This is the underlying object with id, value
6496     *              and extensions. The accessor "getText" gives direct access to
6497     *              the value
6498     */
6499    public NoteComponent setTextElement(StringType value) {
6500      this.text = value;
6501      return this;
6502    }
6503
6504    /**
6505     * @return The explanation or description associated with the processing.
6506     */
6507    public String getText() {
6508      return this.text == null ? null : this.text.getValue();
6509    }
6510
6511    /**
6512     * @param value The explanation or description associated with the processing.
6513     */
6514    public NoteComponent setText(String value) {
6515      if (this.text == null)
6516        this.text = new StringType();
6517      this.text.setValue(value);
6518      return this;
6519    }
6520
6521    /**
6522     * @return {@link #language} (A code to define the language used in the text of
6523     *         the note.)
6524     */
6525    public CodeableConcept getLanguage() {
6526      if (this.language == null)
6527        if (Configuration.errorOnAutoCreate())
6528          throw new Error("Attempt to auto-create NoteComponent.language");
6529        else if (Configuration.doAutoCreate())
6530          this.language = new CodeableConcept(); // cc
6531      return this.language;
6532    }
6533
6534    public boolean hasLanguage() {
6535      return this.language != null && !this.language.isEmpty();
6536    }
6537
6538    /**
6539     * @param value {@link #language} (A code to define the language used in the
6540     *              text of the note.)
6541     */
6542    public NoteComponent setLanguage(CodeableConcept value) {
6543      this.language = value;
6544      return this;
6545    }
6546
6547    protected void listChildren(List<Property> children) {
6548      super.listChildren(children);
6549      children.add(new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1, number));
6550      children.add(new Property("type", "code", "The business purpose of the note text.", 0, 1, type));
6551      children.add(
6552          new Property("text", "string", "The explanation or description associated with the processing.", 0, 1, text));
6553      children.add(new Property("language", "CodeableConcept",
6554          "A code to define the language used in the text of the note.", 0, 1, language));
6555    }
6556
6557    @Override
6558    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
6559      switch (_hash) {
6560      case -1034364087:
6561        /* number */ return new Property("number", "positiveInt", "A number to uniquely identify a note entry.", 0, 1,
6562            number);
6563      case 3575610:
6564        /* type */ return new Property("type", "code", "The business purpose of the note text.", 0, 1, type);
6565      case 3556653:
6566        /* text */ return new Property("text", "string",
6567            "The explanation or description associated with the processing.", 0, 1, text);
6568      case -1613589672:
6569        /* language */ return new Property("language", "CodeableConcept",
6570            "A code to define the language used in the text of the note.", 0, 1, language);
6571      default:
6572        return super.getNamedProperty(_hash, _name, _checkValid);
6573      }
6574
6575    }
6576
6577    @Override
6578    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
6579      switch (hash) {
6580      case -1034364087:
6581        /* number */ return this.number == null ? new Base[0] : new Base[] { this.number }; // PositiveIntType
6582      case 3575610:
6583        /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // Enumeration<NoteType>
6584      case 3556653:
6585        /* text */ return this.text == null ? new Base[0] : new Base[] { this.text }; // StringType
6586      case -1613589672:
6587        /* language */ return this.language == null ? new Base[0] : new Base[] { this.language }; // CodeableConcept
6588      default:
6589        return super.getProperty(hash, name, checkValid);
6590      }
6591
6592    }
6593
6594    @Override
6595    public Base setProperty(int hash, String name, Base value) throws FHIRException {
6596      switch (hash) {
6597      case -1034364087: // number
6598        this.number = castToPositiveInt(value); // PositiveIntType
6599        return value;
6600      case 3575610: // type
6601        value = new NoteTypeEnumFactory().fromType(castToCode(value));
6602        this.type = (Enumeration) value; // Enumeration<NoteType>
6603        return value;
6604      case 3556653: // text
6605        this.text = castToString(value); // StringType
6606        return value;
6607      case -1613589672: // language
6608        this.language = castToCodeableConcept(value); // CodeableConcept
6609        return value;
6610      default:
6611        return super.setProperty(hash, name, value);
6612      }
6613
6614    }
6615
6616    @Override
6617    public Base setProperty(String name, Base value) throws FHIRException {
6618      if (name.equals("number")) {
6619        this.number = castToPositiveInt(value); // PositiveIntType
6620      } else if (name.equals("type")) {
6621        value = new NoteTypeEnumFactory().fromType(castToCode(value));
6622        this.type = (Enumeration) value; // Enumeration<NoteType>
6623      } else if (name.equals("text")) {
6624        this.text = castToString(value); // StringType
6625      } else if (name.equals("language")) {
6626        this.language = castToCodeableConcept(value); // CodeableConcept
6627      } else
6628        return super.setProperty(name, value);
6629      return value;
6630    }
6631
6632    @Override
6633    public Base makeProperty(int hash, String name) throws FHIRException {
6634      switch (hash) {
6635      case -1034364087:
6636        return getNumberElement();
6637      case 3575610:
6638        return getTypeElement();
6639      case 3556653:
6640        return getTextElement();
6641      case -1613589672:
6642        return getLanguage();
6643      default:
6644        return super.makeProperty(hash, name);
6645      }
6646
6647    }
6648
6649    @Override
6650    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
6651      switch (hash) {
6652      case -1034364087:
6653        /* number */ return new String[] { "positiveInt" };
6654      case 3575610:
6655        /* type */ return new String[] { "code" };
6656      case 3556653:
6657        /* text */ return new String[] { "string" };
6658      case -1613589672:
6659        /* language */ return new String[] { "CodeableConcept" };
6660      default:
6661        return super.getTypesForProperty(hash, name);
6662      }
6663
6664    }
6665
6666    @Override
6667    public Base addChild(String name) throws FHIRException {
6668      if (name.equals("number")) {
6669        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.number");
6670      } else if (name.equals("type")) {
6671        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.type");
6672      } else if (name.equals("text")) {
6673        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.text");
6674      } else if (name.equals("language")) {
6675        this.language = new CodeableConcept();
6676        return this.language;
6677      } else
6678        return super.addChild(name);
6679    }
6680
6681    public NoteComponent copy() {
6682      NoteComponent dst = new NoteComponent();
6683      copyValues(dst);
6684      return dst;
6685    }
6686
6687    public void copyValues(NoteComponent dst) {
6688      super.copyValues(dst);
6689      dst.number = number == null ? null : number.copy();
6690      dst.type = type == null ? null : type.copy();
6691      dst.text = text == null ? null : text.copy();
6692      dst.language = language == null ? null : language.copy();
6693    }
6694
6695    @Override
6696    public boolean equalsDeep(Base other_) {
6697      if (!super.equalsDeep(other_))
6698        return false;
6699      if (!(other_ instanceof NoteComponent))
6700        return false;
6701      NoteComponent o = (NoteComponent) other_;
6702      return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
6703          && compareDeep(language, o.language, true);
6704    }
6705
6706    @Override
6707    public boolean equalsShallow(Base other_) {
6708      if (!super.equalsShallow(other_))
6709        return false;
6710      if (!(other_ instanceof NoteComponent))
6711        return false;
6712      NoteComponent o = (NoteComponent) other_;
6713      return compareValues(number, o.number, true) && compareValues(type, o.type, true)
6714          && compareValues(text, o.text, true);
6715    }
6716
6717    public boolean isEmpty() {
6718      return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language);
6719    }
6720
6721    public String fhirType() {
6722      return "ClaimResponse.processNote";
6723
6724    }
6725
6726  }
6727
6728  @Block()
6729  public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
6730    /**
6731     * A number to uniquely identify insurance entries and provide a sequence of
6732     * coverages to convey coordination of benefit order.
6733     */
6734    @Child(name = "sequence", type = {
6735        PositiveIntType.class }, order = 1, min = 1, max = 1, modifier = false, summary = false)
6736    @Description(shortDefinition = "Insurance instance identifier", formalDefinition = "A number to uniquely identify insurance entries and provide a sequence of coverages to convey coordination of benefit order.")
6737    protected PositiveIntType sequence;
6738
6739    /**
6740     * A flag to indicate that this Coverage is to be used for adjudication of this
6741     * claim when set to true.
6742     */
6743    @Child(name = "focal", type = { BooleanType.class }, order = 2, min = 1, max = 1, modifier = false, summary = false)
6744    @Description(shortDefinition = "Coverage to be used for adjudication", formalDefinition = "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.")
6745    protected BooleanType focal;
6746
6747    /**
6748     * Reference to the insurance card level information contained in the Coverage
6749     * resource. The coverage issuing insurer will use these details to locate the
6750     * patient's actual coverage within the insurer's information system.
6751     */
6752    @Child(name = "coverage", type = { Coverage.class }, order = 3, min = 1, max = 1, modifier = false, summary = false)
6753    @Description(shortDefinition = "Insurance information", formalDefinition = "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.")
6754    protected Reference coverage;
6755
6756    /**
6757     * The actual object that is the target of the reference (Reference to the
6758     * insurance card level information contained in the Coverage resource. The
6759     * coverage issuing insurer will use these details to locate the patient's
6760     * actual coverage within the insurer's information system.)
6761     */
6762    protected Coverage coverageTarget;
6763
6764    /**
6765     * A business agreement number established between the provider and the insurer
6766     * for special business processing purposes.
6767     */
6768    @Child(name = "businessArrangement", type = {
6769        StringType.class }, order = 4, min = 0, max = 1, modifier = false, summary = false)
6770    @Description(shortDefinition = "Additional provider contract number", formalDefinition = "A business agreement number established between the provider and the insurer for special business processing purposes.")
6771    protected StringType businessArrangement;
6772
6773    /**
6774     * The result of the adjudication of the line items for the Coverage specified
6775     * in this insurance.
6776     */
6777    @Child(name = "claimResponse", type = {
6778        ClaimResponse.class }, order = 5, min = 0, max = 1, modifier = false, summary = false)
6779    @Description(shortDefinition = "Adjudication results", formalDefinition = "The result of the adjudication of the line items for the Coverage specified in this insurance.")
6780    protected Reference claimResponse;
6781
6782    /**
6783     * The actual object that is the target of the reference (The result of the
6784     * adjudication of the line items for the Coverage specified in this insurance.)
6785     */
6786    protected ClaimResponse claimResponseTarget;
6787
6788    private static final long serialVersionUID = 282380584L;
6789
6790    /**
6791     * Constructor
6792     */
6793    public InsuranceComponent() {
6794      super();
6795    }
6796
6797    /**
6798     * Constructor
6799     */
6800    public InsuranceComponent(PositiveIntType sequence, BooleanType focal, Reference coverage) {
6801      super();
6802      this.sequence = sequence;
6803      this.focal = focal;
6804      this.coverage = coverage;
6805    }
6806
6807    /**
6808     * @return {@link #sequence} (A number to uniquely identify insurance entries
6809     *         and provide a sequence of coverages to convey coordination of benefit
6810     *         order.). This is the underlying object with id, value and extensions.
6811     *         The accessor "getSequence" gives direct access to the value
6812     */
6813    public PositiveIntType getSequenceElement() {
6814      if (this.sequence == null)
6815        if (Configuration.errorOnAutoCreate())
6816          throw new Error("Attempt to auto-create InsuranceComponent.sequence");
6817        else if (Configuration.doAutoCreate())
6818          this.sequence = new PositiveIntType(); // bb
6819      return this.sequence;
6820    }
6821
6822    public boolean hasSequenceElement() {
6823      return this.sequence != null && !this.sequence.isEmpty();
6824    }
6825
6826    public boolean hasSequence() {
6827      return this.sequence != null && !this.sequence.isEmpty();
6828    }
6829
6830    /**
6831     * @param value {@link #sequence} (A number to uniquely identify insurance
6832     *              entries and provide a sequence of coverages to convey
6833     *              coordination of benefit order.). This is the underlying object
6834     *              with id, value and extensions. The accessor "getSequence" gives
6835     *              direct access to the value
6836     */
6837    public InsuranceComponent setSequenceElement(PositiveIntType value) {
6838      this.sequence = value;
6839      return this;
6840    }
6841
6842    /**
6843     * @return A number to uniquely identify insurance entries and provide a
6844     *         sequence of coverages to convey coordination of benefit order.
6845     */
6846    public int getSequence() {
6847      return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
6848    }
6849
6850    /**
6851     * @param value A number to uniquely identify insurance entries and provide a
6852     *              sequence of coverages to convey coordination of benefit order.
6853     */
6854    public InsuranceComponent setSequence(int value) {
6855      if (this.sequence == null)
6856        this.sequence = new PositiveIntType();
6857      this.sequence.setValue(value);
6858      return this;
6859    }
6860
6861    /**
6862     * @return {@link #focal} (A flag to indicate that this Coverage is to be used
6863     *         for adjudication of this claim when set to true.). This is the
6864     *         underlying object with id, value and extensions. The accessor
6865     *         "getFocal" gives direct access to the value
6866     */
6867    public BooleanType getFocalElement() {
6868      if (this.focal == null)
6869        if (Configuration.errorOnAutoCreate())
6870          throw new Error("Attempt to auto-create InsuranceComponent.focal");
6871        else if (Configuration.doAutoCreate())
6872          this.focal = new BooleanType(); // bb
6873      return this.focal;
6874    }
6875
6876    public boolean hasFocalElement() {
6877      return this.focal != null && !this.focal.isEmpty();
6878    }
6879
6880    public boolean hasFocal() {
6881      return this.focal != null && !this.focal.isEmpty();
6882    }
6883
6884    /**
6885     * @param value {@link #focal} (A flag to indicate that this Coverage is to be
6886     *              used for adjudication of this claim when set to true.). This is
6887     *              the underlying object with id, value and extensions. The
6888     *              accessor "getFocal" gives direct access to the value
6889     */
6890    public InsuranceComponent setFocalElement(BooleanType value) {
6891      this.focal = value;
6892      return this;
6893    }
6894
6895    /**
6896     * @return A flag to indicate that this Coverage is to be used for adjudication
6897     *         of this claim when set to true.
6898     */
6899    public boolean getFocal() {
6900      return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
6901    }
6902
6903    /**
6904     * @param value A flag to indicate that this Coverage is to be used for
6905     *              adjudication of this claim when set to true.
6906     */
6907    public InsuranceComponent setFocal(boolean value) {
6908      if (this.focal == null)
6909        this.focal = new BooleanType();
6910      this.focal.setValue(value);
6911      return this;
6912    }
6913
6914    /**
6915     * @return {@link #coverage} (Reference to the insurance card level information
6916     *         contained in the Coverage resource. The coverage issuing insurer will
6917     *         use these details to locate the patient's actual coverage within the
6918     *         insurer's information system.)
6919     */
6920    public Reference getCoverage() {
6921      if (this.coverage == null)
6922        if (Configuration.errorOnAutoCreate())
6923          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
6924        else if (Configuration.doAutoCreate())
6925          this.coverage = new Reference(); // cc
6926      return this.coverage;
6927    }
6928
6929    public boolean hasCoverage() {
6930      return this.coverage != null && !this.coverage.isEmpty();
6931    }
6932
6933    /**
6934     * @param value {@link #coverage} (Reference to the insurance card level
6935     *              information contained in the Coverage resource. The coverage
6936     *              issuing insurer will use these details to locate the patient's
6937     *              actual coverage within the insurer's information system.)
6938     */
6939    public InsuranceComponent setCoverage(Reference value) {
6940      this.coverage = value;
6941      return this;
6942    }
6943
6944    /**
6945     * @return {@link #coverage} The actual object that is the target of the
6946     *         reference. The reference library doesn't populate this, but you can
6947     *         use it to hold the resource if you resolve it. (Reference to the
6948     *         insurance card level information contained in the Coverage resource.
6949     *         The coverage issuing insurer will use these details to locate the
6950     *         patient's actual coverage within the insurer's information system.)
6951     */
6952    public Coverage getCoverageTarget() {
6953      if (this.coverageTarget == null)
6954        if (Configuration.errorOnAutoCreate())
6955          throw new Error("Attempt to auto-create InsuranceComponent.coverage");
6956        else if (Configuration.doAutoCreate())
6957          this.coverageTarget = new Coverage(); // aa
6958      return this.coverageTarget;
6959    }
6960
6961    /**
6962     * @param value {@link #coverage} The actual object that is the target of the
6963     *              reference. The reference library doesn't use these, but you can
6964     *              use it to hold the resource if you resolve it. (Reference to the
6965     *              insurance card level information contained in the Coverage
6966     *              resource. The coverage issuing insurer will use these details to
6967     *              locate the patient's actual coverage within the insurer's
6968     *              information system.)
6969     */
6970    public InsuranceComponent setCoverageTarget(Coverage value) {
6971      this.coverageTarget = value;
6972      return this;
6973    }
6974
6975    /**
6976     * @return {@link #businessArrangement} (A business agreement number established
6977     *         between the provider and the insurer for special business processing
6978     *         purposes.). This is the underlying object with id, value and
6979     *         extensions. The accessor "getBusinessArrangement" gives direct access
6980     *         to the value
6981     */
6982    public StringType getBusinessArrangementElement() {
6983      if (this.businessArrangement == null)
6984        if (Configuration.errorOnAutoCreate())
6985          throw new Error("Attempt to auto-create InsuranceComponent.businessArrangement");
6986        else if (Configuration.doAutoCreate())
6987          this.businessArrangement = new StringType(); // bb
6988      return this.businessArrangement;
6989    }
6990
6991    public boolean hasBusinessArrangementElement() {
6992      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
6993    }
6994
6995    public boolean hasBusinessArrangement() {
6996      return this.businessArrangement != null && !this.businessArrangement.isEmpty();
6997    }
6998
6999    /**
7000     * @param value {@link #businessArrangement} (A business agreement number
7001     *              established between the provider and the insurer for special
7002     *              business processing purposes.). This is the underlying object
7003     *              with id, value and extensions. The accessor
7004     *              "getBusinessArrangement" gives direct access to the value
7005     */
7006    public InsuranceComponent setBusinessArrangementElement(StringType value) {
7007      this.businessArrangement = value;
7008      return this;
7009    }
7010
7011    /**
7012     * @return A business agreement number established between the provider and the
7013     *         insurer for special business processing purposes.
7014     */
7015    public String getBusinessArrangement() {
7016      return this.businessArrangement == null ? null : this.businessArrangement.getValue();
7017    }
7018
7019    /**
7020     * @param value A business agreement number established between the provider and
7021     *              the insurer for special business processing purposes.
7022     */
7023    public InsuranceComponent setBusinessArrangement(String value) {
7024      if (Utilities.noString(value))
7025        this.businessArrangement = null;
7026      else {
7027        if (this.businessArrangement == null)
7028          this.businessArrangement = new StringType();
7029        this.businessArrangement.setValue(value);
7030      }
7031      return this;
7032    }
7033
7034    /**
7035     * @return {@link #claimResponse} (The result of the adjudication of the line
7036     *         items for the Coverage specified in this insurance.)
7037     */
7038    public Reference getClaimResponse() {
7039      if (this.claimResponse == null)
7040        if (Configuration.errorOnAutoCreate())
7041          throw new Error("Attempt to auto-create InsuranceComponent.claimResponse");
7042        else if (Configuration.doAutoCreate())
7043          this.claimResponse = new Reference(); // cc
7044      return this.claimResponse;
7045    }
7046
7047    public boolean hasClaimResponse() {
7048      return this.claimResponse != null && !this.claimResponse.isEmpty();
7049    }
7050
7051    /**
7052     * @param value {@link #claimResponse} (The result of the adjudication of the
7053     *              line items for the Coverage specified in this insurance.)
7054     */
7055    public InsuranceComponent setClaimResponse(Reference value) {
7056      this.claimResponse = value;
7057      return this;
7058    }
7059
7060    /**
7061     * @return {@link #claimResponse} The actual object that is the target of the
7062     *         reference. The reference library doesn't populate this, but you can
7063     *         use it to hold the resource if you resolve it. (The result of the
7064     *         adjudication of the line items for the Coverage specified in this
7065     *         insurance.)
7066     */
7067    public ClaimResponse getClaimResponseTarget() {
7068      if (this.claimResponseTarget == null)
7069        if (Configuration.errorOnAutoCreate())
7070          throw new Error("Attempt to auto-create InsuranceComponent.claimResponse");
7071        else if (Configuration.doAutoCreate())
7072          this.claimResponseTarget = new ClaimResponse(); // aa
7073      return this.claimResponseTarget;
7074    }
7075
7076    /**
7077     * @param value {@link #claimResponse} The actual object that is the target of
7078     *              the reference. The reference library doesn't use these, but you
7079     *              can use it to hold the resource if you resolve it. (The result
7080     *              of the adjudication of the line items for the Coverage specified
7081     *              in this insurance.)
7082     */
7083    public InsuranceComponent setClaimResponseTarget(ClaimResponse value) {
7084      this.claimResponseTarget = value;
7085      return this;
7086    }
7087
7088    protected void listChildren(List<Property> children) {
7089      super.listChildren(children);
7090      children.add(new Property("sequence", "positiveInt",
7091          "A number to uniquely identify insurance entries and provide a sequence of coverages to convey coordination of benefit order.",
7092          0, 1, sequence));
7093      children.add(new Property("focal", "boolean",
7094          "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0, 1,
7095          focal));
7096      children.add(new Property("coverage", "Reference(Coverage)",
7097          "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.",
7098          0, 1, coverage));
7099      children.add(new Property("businessArrangement", "string",
7100          "A business agreement number established between the provider and the insurer for special business processing purposes.",
7101          0, 1, businessArrangement));
7102      children.add(new Property("claimResponse", "Reference(ClaimResponse)",
7103          "The result of the adjudication of the line items for the Coverage specified in this insurance.", 0, 1,
7104          claimResponse));
7105    }
7106
7107    @Override
7108    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7109      switch (_hash) {
7110      case 1349547969:
7111        /* sequence */ return new Property("sequence", "positiveInt",
7112            "A number to uniquely identify insurance entries and provide a sequence of coverages to convey coordination of benefit order.",
7113            0, 1, sequence);
7114      case 97604197:
7115        /* focal */ return new Property("focal", "boolean",
7116            "A flag to indicate that this Coverage is to be used for adjudication of this claim when set to true.", 0,
7117            1, focal);
7118      case -351767064:
7119        /* coverage */ return new Property("coverage", "Reference(Coverage)",
7120            "Reference to the insurance card level information contained in the Coverage resource. The coverage issuing insurer will use these details to locate the patient's actual coverage within the insurer's information system.",
7121            0, 1, coverage);
7122      case 259920682:
7123        /* businessArrangement */ return new Property("businessArrangement", "string",
7124            "A business agreement number established between the provider and the insurer for special business processing purposes.",
7125            0, 1, businessArrangement);
7126      case 689513629:
7127        /* claimResponse */ return new Property("claimResponse", "Reference(ClaimResponse)",
7128            "The result of the adjudication of the line items for the Coverage specified in this insurance.", 0, 1,
7129            claimResponse);
7130      default:
7131        return super.getNamedProperty(_hash, _name, _checkValid);
7132      }
7133
7134    }
7135
7136    @Override
7137    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7138      switch (hash) {
7139      case 1349547969:
7140        /* sequence */ return this.sequence == null ? new Base[0] : new Base[] { this.sequence }; // PositiveIntType
7141      case 97604197:
7142        /* focal */ return this.focal == null ? new Base[0] : new Base[] { this.focal }; // BooleanType
7143      case -351767064:
7144        /* coverage */ return this.coverage == null ? new Base[0] : new Base[] { this.coverage }; // Reference
7145      case 259920682:
7146        /* businessArrangement */ return this.businessArrangement == null ? new Base[0]
7147            : new Base[] { this.businessArrangement }; // StringType
7148      case 689513629:
7149        /* claimResponse */ return this.claimResponse == null ? new Base[0] : new Base[] { this.claimResponse }; // Reference
7150      default:
7151        return super.getProperty(hash, name, checkValid);
7152      }
7153
7154    }
7155
7156    @Override
7157    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7158      switch (hash) {
7159      case 1349547969: // sequence
7160        this.sequence = castToPositiveInt(value); // PositiveIntType
7161        return value;
7162      case 97604197: // focal
7163        this.focal = castToBoolean(value); // BooleanType
7164        return value;
7165      case -351767064: // coverage
7166        this.coverage = castToReference(value); // Reference
7167        return value;
7168      case 259920682: // businessArrangement
7169        this.businessArrangement = castToString(value); // StringType
7170        return value;
7171      case 689513629: // claimResponse
7172        this.claimResponse = castToReference(value); // Reference
7173        return value;
7174      default:
7175        return super.setProperty(hash, name, value);
7176      }
7177
7178    }
7179
7180    @Override
7181    public Base setProperty(String name, Base value) throws FHIRException {
7182      if (name.equals("sequence")) {
7183        this.sequence = castToPositiveInt(value); // PositiveIntType
7184      } else if (name.equals("focal")) {
7185        this.focal = castToBoolean(value); // BooleanType
7186      } else if (name.equals("coverage")) {
7187        this.coverage = castToReference(value); // Reference
7188      } else if (name.equals("businessArrangement")) {
7189        this.businessArrangement = castToString(value); // StringType
7190      } else if (name.equals("claimResponse")) {
7191        this.claimResponse = castToReference(value); // Reference
7192      } else
7193        return super.setProperty(name, value);
7194      return value;
7195    }
7196
7197    @Override
7198    public Base makeProperty(int hash, String name) throws FHIRException {
7199      switch (hash) {
7200      case 1349547969:
7201        return getSequenceElement();
7202      case 97604197:
7203        return getFocalElement();
7204      case -351767064:
7205        return getCoverage();
7206      case 259920682:
7207        return getBusinessArrangementElement();
7208      case 689513629:
7209        return getClaimResponse();
7210      default:
7211        return super.makeProperty(hash, name);
7212      }
7213
7214    }
7215
7216    @Override
7217    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7218      switch (hash) {
7219      case 1349547969:
7220        /* sequence */ return new String[] { "positiveInt" };
7221      case 97604197:
7222        /* focal */ return new String[] { "boolean" };
7223      case -351767064:
7224        /* coverage */ return new String[] { "Reference" };
7225      case 259920682:
7226        /* businessArrangement */ return new String[] { "string" };
7227      case 689513629:
7228        /* claimResponse */ return new String[] { "Reference" };
7229      default:
7230        return super.getTypesForProperty(hash, name);
7231      }
7232
7233    }
7234
7235    @Override
7236    public Base addChild(String name) throws FHIRException {
7237      if (name.equals("sequence")) {
7238        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.sequence");
7239      } else if (name.equals("focal")) {
7240        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.focal");
7241      } else if (name.equals("coverage")) {
7242        this.coverage = new Reference();
7243        return this.coverage;
7244      } else if (name.equals("businessArrangement")) {
7245        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.businessArrangement");
7246      } else if (name.equals("claimResponse")) {
7247        this.claimResponse = new Reference();
7248        return this.claimResponse;
7249      } else
7250        return super.addChild(name);
7251    }
7252
7253    public InsuranceComponent copy() {
7254      InsuranceComponent dst = new InsuranceComponent();
7255      copyValues(dst);
7256      return dst;
7257    }
7258
7259    public void copyValues(InsuranceComponent dst) {
7260      super.copyValues(dst);
7261      dst.sequence = sequence == null ? null : sequence.copy();
7262      dst.focal = focal == null ? null : focal.copy();
7263      dst.coverage = coverage == null ? null : coverage.copy();
7264      dst.businessArrangement = businessArrangement == null ? null : businessArrangement.copy();
7265      dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
7266    }
7267
7268    @Override
7269    public boolean equalsDeep(Base other_) {
7270      if (!super.equalsDeep(other_))
7271        return false;
7272      if (!(other_ instanceof InsuranceComponent))
7273        return false;
7274      InsuranceComponent o = (InsuranceComponent) other_;
7275      return compareDeep(sequence, o.sequence, true) && compareDeep(focal, o.focal, true)
7276          && compareDeep(coverage, o.coverage, true) && compareDeep(businessArrangement, o.businessArrangement, true)
7277          && compareDeep(claimResponse, o.claimResponse, true);
7278    }
7279
7280    @Override
7281    public boolean equalsShallow(Base other_) {
7282      if (!super.equalsShallow(other_))
7283        return false;
7284      if (!(other_ instanceof InsuranceComponent))
7285        return false;
7286      InsuranceComponent o = (InsuranceComponent) other_;
7287      return compareValues(sequence, o.sequence, true) && compareValues(focal, o.focal, true)
7288          && compareValues(businessArrangement, o.businessArrangement, true);
7289    }
7290
7291    public boolean isEmpty() {
7292      return super.isEmpty()
7293          && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, focal, coverage, businessArrangement, claimResponse);
7294    }
7295
7296    public String fhirType() {
7297      return "ClaimResponse.insurance";
7298
7299    }
7300
7301  }
7302
7303  @Block()
7304  public static class ErrorComponent extends BackboneElement implements IBaseBackboneElement {
7305    /**
7306     * The sequence number of the line item submitted which contains the error. This
7307     * value is omitted when the error occurs outside of the item structure.
7308     */
7309    @Child(name = "itemSequence", type = {
7310        PositiveIntType.class }, order = 1, min = 0, max = 1, modifier = false, summary = false)
7311    @Description(shortDefinition = "Item sequence number", formalDefinition = "The sequence number of the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.")
7312    protected PositiveIntType itemSequence;
7313
7314    /**
7315     * The sequence number of the detail within the line item submitted which
7316     * contains the error. This value is omitted when the error occurs outside of
7317     * the item structure.
7318     */
7319    @Child(name = "detailSequence", type = {
7320        PositiveIntType.class }, order = 2, min = 0, max = 1, modifier = false, summary = false)
7321    @Description(shortDefinition = "Detail sequence number", formalDefinition = "The sequence number of the detail within the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.")
7322    protected PositiveIntType detailSequence;
7323
7324    /**
7325     * The sequence number of the sub-detail within the detail within the line item
7326     * submitted which contains the error. This value is omitted when the error
7327     * occurs outside of the item structure.
7328     */
7329    @Child(name = "subDetailSequence", type = {
7330        PositiveIntType.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
7331    @Description(shortDefinition = "Subdetail sequence number", formalDefinition = "The sequence number of the sub-detail within the detail within the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.")
7332    protected PositiveIntType subDetailSequence;
7333
7334    /**
7335     * An error code, from a specified code system, which details why the claim
7336     * could not be adjudicated.
7337     */
7338    @Child(name = "code", type = {
7339        CodeableConcept.class }, order = 4, min = 1, max = 1, modifier = false, summary = false)
7340    @Description(shortDefinition = "Error code detailing processing issues", formalDefinition = "An error code, from a specified code system, which details why the claim could not be adjudicated.")
7341    @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/adjudication-error")
7342    protected CodeableConcept code;
7343
7344    private static final long serialVersionUID = 843818320L;
7345
7346    /**
7347     * Constructor
7348     */
7349    public ErrorComponent() {
7350      super();
7351    }
7352
7353    /**
7354     * Constructor
7355     */
7356    public ErrorComponent(CodeableConcept code) {
7357      super();
7358      this.code = code;
7359    }
7360
7361    /**
7362     * @return {@link #itemSequence} (The sequence number of the line item submitted
7363     *         which contains the error. This value is omitted when the error occurs
7364     *         outside of the item structure.). This is the underlying object with
7365     *         id, value and extensions. The accessor "getItemSequence" gives direct
7366     *         access to the value
7367     */
7368    public PositiveIntType getItemSequenceElement() {
7369      if (this.itemSequence == null)
7370        if (Configuration.errorOnAutoCreate())
7371          throw new Error("Attempt to auto-create ErrorComponent.itemSequence");
7372        else if (Configuration.doAutoCreate())
7373          this.itemSequence = new PositiveIntType(); // bb
7374      return this.itemSequence;
7375    }
7376
7377    public boolean hasItemSequenceElement() {
7378      return this.itemSequence != null && !this.itemSequence.isEmpty();
7379    }
7380
7381    public boolean hasItemSequence() {
7382      return this.itemSequence != null && !this.itemSequence.isEmpty();
7383    }
7384
7385    /**
7386     * @param value {@link #itemSequence} (The sequence number of the line item
7387     *              submitted which contains the error. This value is omitted when
7388     *              the error occurs outside of the item structure.). This is the
7389     *              underlying object with id, value and extensions. The accessor
7390     *              "getItemSequence" gives direct access to the value
7391     */
7392    public ErrorComponent setItemSequenceElement(PositiveIntType value) {
7393      this.itemSequence = value;
7394      return this;
7395    }
7396
7397    /**
7398     * @return The sequence number of the line item submitted which contains the
7399     *         error. This value is omitted when the error occurs outside of the
7400     *         item structure.
7401     */
7402    public int getItemSequence() {
7403      return this.itemSequence == null || this.itemSequence.isEmpty() ? 0 : this.itemSequence.getValue();
7404    }
7405
7406    /**
7407     * @param value The sequence number of the line item submitted which contains
7408     *              the error. This value is omitted when the error occurs outside
7409     *              of the item structure.
7410     */
7411    public ErrorComponent setItemSequence(int value) {
7412      if (this.itemSequence == null)
7413        this.itemSequence = new PositiveIntType();
7414      this.itemSequence.setValue(value);
7415      return this;
7416    }
7417
7418    /**
7419     * @return {@link #detailSequence} (The sequence number of the detail within the
7420     *         line item submitted which contains the error. This value is omitted
7421     *         when the error occurs outside of the item structure.). This is the
7422     *         underlying object with id, value and extensions. The accessor
7423     *         "getDetailSequence" gives direct access to the value
7424     */
7425    public PositiveIntType getDetailSequenceElement() {
7426      if (this.detailSequence == null)
7427        if (Configuration.errorOnAutoCreate())
7428          throw new Error("Attempt to auto-create ErrorComponent.detailSequence");
7429        else if (Configuration.doAutoCreate())
7430          this.detailSequence = new PositiveIntType(); // bb
7431      return this.detailSequence;
7432    }
7433
7434    public boolean hasDetailSequenceElement() {
7435      return this.detailSequence != null && !this.detailSequence.isEmpty();
7436    }
7437
7438    public boolean hasDetailSequence() {
7439      return this.detailSequence != null && !this.detailSequence.isEmpty();
7440    }
7441
7442    /**
7443     * @param value {@link #detailSequence} (The sequence number of the detail
7444     *              within the line item submitted which contains the error. This
7445     *              value is omitted when the error occurs outside of the item
7446     *              structure.). This is the underlying object with id, value and
7447     *              extensions. The accessor "getDetailSequence" gives direct access
7448     *              to the value
7449     */
7450    public ErrorComponent setDetailSequenceElement(PositiveIntType value) {
7451      this.detailSequence = value;
7452      return this;
7453    }
7454
7455    /**
7456     * @return The sequence number of the detail within the line item submitted
7457     *         which contains the error. This value is omitted when the error occurs
7458     *         outside of the item structure.
7459     */
7460    public int getDetailSequence() {
7461      return this.detailSequence == null || this.detailSequence.isEmpty() ? 0 : this.detailSequence.getValue();
7462    }
7463
7464    /**
7465     * @param value The sequence number of the detail within the line item submitted
7466     *              which contains the error. This value is omitted when the error
7467     *              occurs outside of the item structure.
7468     */
7469    public ErrorComponent setDetailSequence(int value) {
7470      if (this.detailSequence == null)
7471        this.detailSequence = new PositiveIntType();
7472      this.detailSequence.setValue(value);
7473      return this;
7474    }
7475
7476    /**
7477     * @return {@link #subDetailSequence} (The sequence number of the sub-detail
7478     *         within the detail within the line item submitted which contains the
7479     *         error. This value is omitted when the error occurs outside of the
7480     *         item structure.). This is the underlying object with id, value and
7481     *         extensions. The accessor "getSubDetailSequence" gives direct access
7482     *         to the value
7483     */
7484    public PositiveIntType getSubDetailSequenceElement() {
7485      if (this.subDetailSequence == null)
7486        if (Configuration.errorOnAutoCreate())
7487          throw new Error("Attempt to auto-create ErrorComponent.subDetailSequence");
7488        else if (Configuration.doAutoCreate())
7489          this.subDetailSequence = new PositiveIntType(); // bb
7490      return this.subDetailSequence;
7491    }
7492
7493    public boolean hasSubDetailSequenceElement() {
7494      return this.subDetailSequence != null && !this.subDetailSequence.isEmpty();
7495    }
7496
7497    public boolean hasSubDetailSequence() {
7498      return this.subDetailSequence != null && !this.subDetailSequence.isEmpty();
7499    }
7500
7501    /**
7502     * @param value {@link #subDetailSequence} (The sequence number of the
7503     *              sub-detail within the detail within the line item submitted
7504     *              which contains the error. This value is omitted when the error
7505     *              occurs outside of the item structure.). This is the underlying
7506     *              object with id, value and extensions. The accessor
7507     *              "getSubDetailSequence" gives direct access to the value
7508     */
7509    public ErrorComponent setSubDetailSequenceElement(PositiveIntType value) {
7510      this.subDetailSequence = value;
7511      return this;
7512    }
7513
7514    /**
7515     * @return The sequence number of the sub-detail within the detail within the
7516     *         line item submitted which contains the error. This value is omitted
7517     *         when the error occurs outside of the item structure.
7518     */
7519    public int getSubDetailSequence() {
7520      return this.subDetailSequence == null || this.subDetailSequence.isEmpty() ? 0 : this.subDetailSequence.getValue();
7521    }
7522
7523    /**
7524     * @param value The sequence number of the sub-detail within the detail within
7525     *              the line item submitted which contains the error. This value is
7526     *              omitted when the error occurs outside of the item structure.
7527     */
7528    public ErrorComponent setSubDetailSequence(int value) {
7529      if (this.subDetailSequence == null)
7530        this.subDetailSequence = new PositiveIntType();
7531      this.subDetailSequence.setValue(value);
7532      return this;
7533    }
7534
7535    /**
7536     * @return {@link #code} (An error code, from a specified code system, which
7537     *         details why the claim could not be adjudicated.)
7538     */
7539    public CodeableConcept getCode() {
7540      if (this.code == null)
7541        if (Configuration.errorOnAutoCreate())
7542          throw new Error("Attempt to auto-create ErrorComponent.code");
7543        else if (Configuration.doAutoCreate())
7544          this.code = new CodeableConcept(); // cc
7545      return this.code;
7546    }
7547
7548    public boolean hasCode() {
7549      return this.code != null && !this.code.isEmpty();
7550    }
7551
7552    /**
7553     * @param value {@link #code} (An error code, from a specified code system,
7554     *              which details why the claim could not be adjudicated.)
7555     */
7556    public ErrorComponent setCode(CodeableConcept value) {
7557      this.code = value;
7558      return this;
7559    }
7560
7561    protected void listChildren(List<Property> children) {
7562      super.listChildren(children);
7563      children.add(new Property("itemSequence", "positiveInt",
7564          "The sequence number of the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.",
7565          0, 1, itemSequence));
7566      children.add(new Property("detailSequence", "positiveInt",
7567          "The sequence number of the detail within the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.",
7568          0, 1, detailSequence));
7569      children.add(new Property("subDetailSequence", "positiveInt",
7570          "The sequence number of the sub-detail within the detail within the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.",
7571          0, 1, subDetailSequence));
7572      children.add(new Property("code", "CodeableConcept",
7573          "An error code, from a specified code system, which details why the claim could not be adjudicated.", 0, 1,
7574          code));
7575    }
7576
7577    @Override
7578    public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
7579      switch (_hash) {
7580      case 1977979892:
7581        /* itemSequence */ return new Property("itemSequence", "positiveInt",
7582            "The sequence number of the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.",
7583            0, 1, itemSequence);
7584      case 1321472818:
7585        /* detailSequence */ return new Property("detailSequence", "positiveInt",
7586            "The sequence number of the detail within the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.",
7587            0, 1, detailSequence);
7588      case -855462510:
7589        /* subDetailSequence */ return new Property("subDetailSequence", "positiveInt",
7590            "The sequence number of the sub-detail within the detail within the line item submitted which contains the error. This value is omitted when the error occurs outside of the item structure.",
7591            0, 1, subDetailSequence);
7592      case 3059181:
7593        /* code */ return new Property("code", "CodeableConcept",
7594            "An error code, from a specified code system, which details why the claim could not be adjudicated.", 0, 1,
7595            code);
7596      default:
7597        return super.getNamedProperty(_hash, _name, _checkValid);
7598      }
7599
7600    }
7601
7602    @Override
7603    public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
7604      switch (hash) {
7605      case 1977979892:
7606        /* itemSequence */ return this.itemSequence == null ? new Base[0] : new Base[] { this.itemSequence }; // PositiveIntType
7607      case 1321472818:
7608        /* detailSequence */ return this.detailSequence == null ? new Base[0] : new Base[] { this.detailSequence }; // PositiveIntType
7609      case -855462510:
7610        /* subDetailSequence */ return this.subDetailSequence == null ? new Base[0]
7611            : new Base[] { this.subDetailSequence }; // PositiveIntType
7612      case 3059181:
7613        /* code */ return this.code == null ? new Base[0] : new Base[] { this.code }; // CodeableConcept
7614      default:
7615        return super.getProperty(hash, name, checkValid);
7616      }
7617
7618    }
7619
7620    @Override
7621    public Base setProperty(int hash, String name, Base value) throws FHIRException {
7622      switch (hash) {
7623      case 1977979892: // itemSequence
7624        this.itemSequence = castToPositiveInt(value); // PositiveIntType
7625        return value;
7626      case 1321472818: // detailSequence
7627        this.detailSequence = castToPositiveInt(value); // PositiveIntType
7628        return value;
7629      case -855462510: // subDetailSequence
7630        this.subDetailSequence = castToPositiveInt(value); // PositiveIntType
7631        return value;
7632      case 3059181: // code
7633        this.code = castToCodeableConcept(value); // CodeableConcept
7634        return value;
7635      default:
7636        return super.setProperty(hash, name, value);
7637      }
7638
7639    }
7640
7641    @Override
7642    public Base setProperty(String name, Base value) throws FHIRException {
7643      if (name.equals("itemSequence")) {
7644        this.itemSequence = castToPositiveInt(value); // PositiveIntType
7645      } else if (name.equals("detailSequence")) {
7646        this.detailSequence = castToPositiveInt(value); // PositiveIntType
7647      } else if (name.equals("subDetailSequence")) {
7648        this.subDetailSequence = castToPositiveInt(value); // PositiveIntType
7649      } else if (name.equals("code")) {
7650        this.code = castToCodeableConcept(value); // CodeableConcept
7651      } else
7652        return super.setProperty(name, value);
7653      return value;
7654    }
7655
7656    @Override
7657    public Base makeProperty(int hash, String name) throws FHIRException {
7658      switch (hash) {
7659      case 1977979892:
7660        return getItemSequenceElement();
7661      case 1321472818:
7662        return getDetailSequenceElement();
7663      case -855462510:
7664        return getSubDetailSequenceElement();
7665      case 3059181:
7666        return getCode();
7667      default:
7668        return super.makeProperty(hash, name);
7669      }
7670
7671    }
7672
7673    @Override
7674    public String[] getTypesForProperty(int hash, String name) throws FHIRException {
7675      switch (hash) {
7676      case 1977979892:
7677        /* itemSequence */ return new String[] { "positiveInt" };
7678      case 1321472818:
7679        /* detailSequence */ return new String[] { "positiveInt" };
7680      case -855462510:
7681        /* subDetailSequence */ return new String[] { "positiveInt" };
7682      case 3059181:
7683        /* code */ return new String[] { "CodeableConcept" };
7684      default:
7685        return super.getTypesForProperty(hash, name);
7686      }
7687
7688    }
7689
7690    @Override
7691    public Base addChild(String name) throws FHIRException {
7692      if (name.equals("itemSequence")) {
7693        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.itemSequence");
7694      } else if (name.equals("detailSequence")) {
7695        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.detailSequence");
7696      } else if (name.equals("subDetailSequence")) {
7697        throw new FHIRException("Cannot call addChild on a singleton property ClaimResponse.subDetailSequence");
7698      } else if (name.equals("code")) {
7699        this.code = new CodeableConcept();
7700        return this.code;
7701      } else
7702        return super.addChild(name);
7703    }
7704
7705    public ErrorComponent copy() {
7706      ErrorComponent dst = new ErrorComponent();
7707      copyValues(dst);
7708      return dst;
7709    }
7710
7711    public void copyValues(ErrorComponent dst) {
7712      super.copyValues(dst);
7713      dst.itemSequence = itemSequence == null ? null : itemSequence.copy();
7714      dst.detailSequence = detailSequence == null ? null : detailSequence.copy();
7715      dst.subDetailSequence = subDetailSequence == null ? null : subDetailSequence.copy();
7716      dst.code = code == null ? null : code.copy();
7717    }
7718
7719    @Override
7720    public boolean equalsDeep(Base other_) {
7721      if (!super.equalsDeep(other_))
7722        return false;
7723      if (!(other_ instanceof ErrorComponent))
7724        return false;
7725      ErrorComponent o = (ErrorComponent) other_;
7726      return compareDeep(itemSequence, o.itemSequence, true) && compareDeep(detailSequence, o.detailSequence, true)
7727          && compareDeep(subDetailSequence, o.subDetailSequence, true) && compareDeep(code, o.code, true);
7728    }
7729
7730    @Override
7731    public boolean equalsShallow(Base other_) {
7732      if (!super.equalsShallow(other_))
7733        return false;
7734      if (!(other_ instanceof ErrorComponent))
7735        return false;
7736      ErrorComponent o = (ErrorComponent) other_;
7737      return compareValues(itemSequence, o.itemSequence, true) && compareValues(detailSequence, o.detailSequence, true)
7738          && compareValues(subDetailSequence, o.subDetailSequence, true);
7739    }
7740
7741    public boolean isEmpty() {
7742      return super.isEmpty()
7743          && ca.uhn.fhir.util.ElementUtil.isEmpty(itemSequence, detailSequence, subDetailSequence, code);
7744    }
7745
7746    public String fhirType() {
7747      return "ClaimResponse.error";
7748
7749    }
7750
7751  }
7752
7753  /**
7754   * A unique identifier assigned to this claim response.
7755   */
7756  @Child(name = "identifier", type = {
7757      Identifier.class }, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7758  @Description(shortDefinition = "Business Identifier for a claim response", formalDefinition = "A unique identifier assigned to this claim response.")
7759  protected List<Identifier> identifier;
7760
7761  /**
7762   * The status of the resource instance.
7763   */
7764  @Child(name = "status", type = { CodeType.class }, order = 1, min = 1, max = 1, modifier = true, summary = true)
7765  @Description(shortDefinition = "active | cancelled | draft | entered-in-error", formalDefinition = "The status of the resource instance.")
7766  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fm-status")
7767  protected Enumeration<ClaimResponseStatus> status;
7768
7769  /**
7770   * A finer grained suite of claim type codes which may convey additional
7771   * information such as Inpatient vs Outpatient and/or a specialty service.
7772   */
7773  @Child(name = "type", type = { CodeableConcept.class }, order = 2, min = 1, max = 1, modifier = false, summary = true)
7774  @Description(shortDefinition = "More granular claim type", formalDefinition = "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.")
7775  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-type")
7776  protected CodeableConcept type;
7777
7778  /**
7779   * A finer grained suite of claim type codes which may convey additional
7780   * information such as Inpatient vs Outpatient and/or a specialty service.
7781   */
7782  @Child(name = "subType", type = {
7783      CodeableConcept.class }, order = 3, min = 0, max = 1, modifier = false, summary = false)
7784  @Description(shortDefinition = "More granular claim type", formalDefinition = "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.")
7785  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-subtype")
7786  protected CodeableConcept subType;
7787
7788  /**
7789   * A code to indicate whether the nature of the request is: to request
7790   * adjudication of products and services previously rendered; or requesting
7791   * authorization and adjudication for provision in the future; or requesting the
7792   * non-binding adjudication of the listed products and services which could be
7793   * provided in the future.
7794   */
7795  @Child(name = "use", type = { CodeType.class }, order = 4, min = 1, max = 1, modifier = false, summary = true)
7796  @Description(shortDefinition = "claim | preauthorization | predetermination", formalDefinition = "A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.")
7797  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/claim-use")
7798  protected Enumeration<Use> use;
7799
7800  /**
7801   * The party to whom the professional services and/or products have been
7802   * supplied or are being considered and for whom actual for facast reimbursement
7803   * is sought.
7804   */
7805  @Child(name = "patient", type = { Patient.class }, order = 5, min = 1, max = 1, modifier = false, summary = true)
7806  @Description(shortDefinition = "The recipient of the products and services", formalDefinition = "The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for facast reimbursement is sought.")
7807  protected Reference patient;
7808
7809  /**
7810   * The actual object that is the target of the reference (The party to whom the
7811   * professional services and/or products have been supplied or are being
7812   * considered and for whom actual for facast reimbursement is sought.)
7813   */
7814  protected Patient patientTarget;
7815
7816  /**
7817   * The date this resource was created.
7818   */
7819  @Child(name = "created", type = { DateTimeType.class }, order = 6, min = 1, max = 1, modifier = false, summary = true)
7820  @Description(shortDefinition = "Response creation date", formalDefinition = "The date this resource was created.")
7821  protected DateTimeType created;
7822
7823  /**
7824   * The party responsible for authorization, adjudication and reimbursement.
7825   */
7826  @Child(name = "insurer", type = { Organization.class }, order = 7, min = 1, max = 1, modifier = false, summary = true)
7827  @Description(shortDefinition = "Party responsible for reimbursement", formalDefinition = "The party responsible for authorization, adjudication and reimbursement.")
7828  protected Reference insurer;
7829
7830  /**
7831   * The actual object that is the target of the reference (The party responsible
7832   * for authorization, adjudication and reimbursement.)
7833   */
7834  protected Organization insurerTarget;
7835
7836  /**
7837   * The provider which is responsible for the claim, predetermination or
7838   * preauthorization.
7839   */
7840  @Child(name = "requestor", type = { Practitioner.class, PractitionerRole.class,
7841      Organization.class }, order = 8, min = 0, max = 1, modifier = false, summary = false)
7842  @Description(shortDefinition = "Party responsible for the claim", formalDefinition = "The provider which is responsible for the claim, predetermination or preauthorization.")
7843  protected Reference requestor;
7844
7845  /**
7846   * The actual object that is the target of the reference (The provider which is
7847   * responsible for the claim, predetermination or preauthorization.)
7848   */
7849  protected Resource requestorTarget;
7850
7851  /**
7852   * Original request resource reference.
7853   */
7854  @Child(name = "request", type = { Claim.class }, order = 9, min = 0, max = 1, modifier = false, summary = true)
7855  @Description(shortDefinition = "Id of resource triggering adjudication", formalDefinition = "Original request resource reference.")
7856  protected Reference request;
7857
7858  /**
7859   * The actual object that is the target of the reference (Original request
7860   * resource reference.)
7861   */
7862  protected Claim requestTarget;
7863
7864  /**
7865   * The outcome of the claim, predetermination, or preauthorization processing.
7866   */
7867  @Child(name = "outcome", type = { CodeType.class }, order = 10, min = 1, max = 1, modifier = false, summary = true)
7868  @Description(shortDefinition = "queued | complete | error | partial", formalDefinition = "The outcome of the claim, predetermination, or preauthorization processing.")
7869  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/remittance-outcome")
7870  protected Enumeration<RemittanceOutcome> outcome;
7871
7872  /**
7873   * A human readable description of the status of the adjudication.
7874   */
7875  @Child(name = "disposition", type = {
7876      StringType.class }, order = 11, min = 0, max = 1, modifier = false, summary = false)
7877  @Description(shortDefinition = "Disposition Message", formalDefinition = "A human readable description of the status of the adjudication.")
7878  protected StringType disposition;
7879
7880  /**
7881   * Reference from the Insurer which is used in later communications which refers
7882   * to this adjudication.
7883   */
7884  @Child(name = "preAuthRef", type = {
7885      StringType.class }, order = 12, min = 0, max = 1, modifier = false, summary = false)
7886  @Description(shortDefinition = "Preauthorization reference", formalDefinition = "Reference from the Insurer which is used in later communications which refers to this adjudication.")
7887  protected StringType preAuthRef;
7888
7889  /**
7890   * The time frame during which this authorization is effective.
7891   */
7892  @Child(name = "preAuthPeriod", type = {
7893      Period.class }, order = 13, min = 0, max = 1, modifier = false, summary = false)
7894  @Description(shortDefinition = "Preauthorization reference effective period", formalDefinition = "The time frame during which this authorization is effective.")
7895  protected Period preAuthPeriod;
7896
7897  /**
7898   * Type of Party to be reimbursed: subscriber, provider, other.
7899   */
7900  @Child(name = "payeeType", type = {
7901      CodeableConcept.class }, order = 14, min = 0, max = 1, modifier = false, summary = false)
7902  @Description(shortDefinition = "Party to be paid any benefits payable", formalDefinition = "Type of Party to be reimbursed: subscriber, provider, other.")
7903  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/payeetype")
7904  protected CodeableConcept payeeType;
7905
7906  /**
7907   * A claim line. Either a simple (a product or service) or a 'group' of details
7908   * which can also be a simple items or groups of sub-details.
7909   */
7910  @Child(name = "item", type = {}, order = 15, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7911  @Description(shortDefinition = "Adjudication for claim line items", formalDefinition = "A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.")
7912  protected List<ItemComponent> item;
7913
7914  /**
7915   * The first-tier service adjudications for payor added product or service
7916   * lines.
7917   */
7918  @Child(name = "addItem", type = {}, order = 16, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7919  @Description(shortDefinition = "Insurer added line items", formalDefinition = "The first-tier service adjudications for payor added product or service lines.")
7920  protected List<AddedItemComponent> addItem;
7921
7922  /**
7923   * The adjudication results which are presented at the header level rather than
7924   * at the line-item or add-item levels.
7925   */
7926  @Child(name = "adjudication", type = {
7927      AdjudicationComponent.class }, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7928  @Description(shortDefinition = "Header-level adjudication", formalDefinition = "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.")
7929  protected List<AdjudicationComponent> adjudication;
7930
7931  /**
7932   * Categorized monetary totals for the adjudication.
7933   */
7934  @Child(name = "total", type = {}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true)
7935  @Description(shortDefinition = "Adjudication totals", formalDefinition = "Categorized monetary totals for the adjudication.")
7936  protected List<TotalComponent> total;
7937
7938  /**
7939   * Payment details for the adjudication of the claim.
7940   */
7941  @Child(name = "payment", type = {}, order = 19, min = 0, max = 1, modifier = false, summary = false)
7942  @Description(shortDefinition = "Payment Details", formalDefinition = "Payment details for the adjudication of the claim.")
7943  protected PaymentComponent payment;
7944
7945  /**
7946   * A code, used only on a response to a preauthorization, to indicate whether
7947   * the benefits payable have been reserved and for whom.
7948   */
7949  @Child(name = "fundsReserve", type = {
7950      CodeableConcept.class }, order = 20, min = 0, max = 1, modifier = false, summary = false)
7951  @Description(shortDefinition = "Funds reserved status", formalDefinition = "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.")
7952  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/fundsreserve")
7953  protected CodeableConcept fundsReserve;
7954
7955  /**
7956   * A code for the form to be used for printing the content.
7957   */
7958  @Child(name = "formCode", type = {
7959      CodeableConcept.class }, order = 21, min = 0, max = 1, modifier = false, summary = false)
7960  @Description(shortDefinition = "Printed form identifier", formalDefinition = "A code for the form to be used for printing the content.")
7961  @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/forms")
7962  protected CodeableConcept formCode;
7963
7964  /**
7965   * The actual form, by reference or inclusion, for printing the content or an
7966   * EOB.
7967   */
7968  @Child(name = "form", type = { Attachment.class }, order = 22, min = 0, max = 1, modifier = false, summary = false)
7969  @Description(shortDefinition = "Printed reference or actual form", formalDefinition = "The actual form, by reference or inclusion, for printing the content or an EOB.")
7970  protected Attachment form;
7971
7972  /**
7973   * A note that describes or explains adjudication results in a human readable
7974   * form.
7975   */
7976  @Child(name = "processNote", type = {}, order = 23, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7977  @Description(shortDefinition = "Note concerning adjudication", formalDefinition = "A note that describes or explains adjudication results in a human readable form.")
7978  protected List<NoteComponent> processNote;
7979
7980  /**
7981   * Request for additional supporting or authorizing information.
7982   */
7983  @Child(name = "communicationRequest", type = {
7984      CommunicationRequest.class }, order = 24, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7985  @Description(shortDefinition = "Request for additional information", formalDefinition = "Request for additional supporting or authorizing information.")
7986  protected List<Reference> communicationRequest;
7987  /**
7988   * The actual objects that are the target of the reference (Request for
7989   * additional supporting or authorizing information.)
7990   */
7991  protected List<CommunicationRequest> communicationRequestTarget;
7992
7993  /**
7994   * Financial instruments for reimbursement for the health care products and
7995   * services specified on the claim.
7996   */
7997  @Child(name = "insurance", type = {}, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
7998  @Description(shortDefinition = "Patient insurance information", formalDefinition = "Financial instruments for reimbursement for the health care products and services specified on the claim.")
7999  protected List<InsuranceComponent> insurance;
8000
8001  /**
8002   * Errors encountered during the processing of the adjudication.
8003   */
8004  @Child(name = "error", type = {}, order = 26, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false)
8005  @Description(shortDefinition = "Processing errors", formalDefinition = "Errors encountered during the processing of the adjudication.")
8006  protected List<ErrorComponent> error;
8007
8008  private static final long serialVersionUID = 731586651L;
8009
8010  /**
8011   * Constructor
8012   */
8013  public ClaimResponse() {
8014    super();
8015  }
8016
8017  /**
8018   * Constructor
8019   */
8020  public ClaimResponse(Enumeration<ClaimResponseStatus> status, CodeableConcept type, Enumeration<Use> use,
8021      Reference patient, DateTimeType created, Reference insurer, Enumeration<RemittanceOutcome> outcome) {
8022    super();
8023    this.status = status;
8024    this.type = type;
8025    this.use = use;
8026    this.patient = patient;
8027    this.created = created;
8028    this.insurer = insurer;
8029    this.outcome = outcome;
8030  }
8031
8032  /**
8033   * @return {@link #identifier} (A unique identifier assigned to this claim
8034   *         response.)
8035   */
8036  public List<Identifier> getIdentifier() {
8037    if (this.identifier == null)
8038      this.identifier = new ArrayList<Identifier>();
8039    return this.identifier;
8040  }
8041
8042  /**
8043   * @return Returns a reference to <code>this</code> for easy method chaining
8044   */
8045  public ClaimResponse setIdentifier(List<Identifier> theIdentifier) {
8046    this.identifier = theIdentifier;
8047    return this;
8048  }
8049
8050  public boolean hasIdentifier() {
8051    if (this.identifier == null)
8052      return false;
8053    for (Identifier item : this.identifier)
8054      if (!item.isEmpty())
8055        return true;
8056    return false;
8057  }
8058
8059  public Identifier addIdentifier() { // 3
8060    Identifier t = new Identifier();
8061    if (this.identifier == null)
8062      this.identifier = new ArrayList<Identifier>();
8063    this.identifier.add(t);
8064    return t;
8065  }
8066
8067  public ClaimResponse addIdentifier(Identifier t) { // 3
8068    if (t == null)
8069      return this;
8070    if (this.identifier == null)
8071      this.identifier = new ArrayList<Identifier>();
8072    this.identifier.add(t);
8073    return this;
8074  }
8075
8076  /**
8077   * @return The first repetition of repeating field {@link #identifier}, creating
8078   *         it if it does not already exist
8079   */
8080  public Identifier getIdentifierFirstRep() {
8081    if (getIdentifier().isEmpty()) {
8082      addIdentifier();
8083    }
8084    return getIdentifier().get(0);
8085  }
8086
8087  /**
8088   * @return {@link #status} (The status of the resource instance.). This is the
8089   *         underlying object with id, value and extensions. The accessor
8090   *         "getStatus" gives direct access to the value
8091   */
8092  public Enumeration<ClaimResponseStatus> getStatusElement() {
8093    if (this.status == null)
8094      if (Configuration.errorOnAutoCreate())
8095        throw new Error("Attempt to auto-create ClaimResponse.status");
8096      else if (Configuration.doAutoCreate())
8097        this.status = new Enumeration<ClaimResponseStatus>(new ClaimResponseStatusEnumFactory()); // bb
8098    return this.status;
8099  }
8100
8101  public boolean hasStatusElement() {
8102    return this.status != null && !this.status.isEmpty();
8103  }
8104
8105  public boolean hasStatus() {
8106    return this.status != null && !this.status.isEmpty();
8107  }
8108
8109  /**
8110   * @param value {@link #status} (The status of the resource instance.). This is
8111   *              the underlying object with id, value and extensions. The
8112   *              accessor "getStatus" gives direct access to the value
8113   */
8114  public ClaimResponse setStatusElement(Enumeration<ClaimResponseStatus> value) {
8115    this.status = value;
8116    return this;
8117  }
8118
8119  /**
8120   * @return The status of the resource instance.
8121   */
8122  public ClaimResponseStatus getStatus() {
8123    return this.status == null ? null : this.status.getValue();
8124  }
8125
8126  /**
8127   * @param value The status of the resource instance.
8128   */
8129  public ClaimResponse setStatus(ClaimResponseStatus value) {
8130    if (this.status == null)
8131      this.status = new Enumeration<ClaimResponseStatus>(new ClaimResponseStatusEnumFactory());
8132    this.status.setValue(value);
8133    return this;
8134  }
8135
8136  /**
8137   * @return {@link #type} (A finer grained suite of claim type codes which may
8138   *         convey additional information such as Inpatient vs Outpatient and/or
8139   *         a specialty service.)
8140   */
8141  public CodeableConcept getType() {
8142    if (this.type == null)
8143      if (Configuration.errorOnAutoCreate())
8144        throw new Error("Attempt to auto-create ClaimResponse.type");
8145      else if (Configuration.doAutoCreate())
8146        this.type = new CodeableConcept(); // cc
8147    return this.type;
8148  }
8149
8150  public boolean hasType() {
8151    return this.type != null && !this.type.isEmpty();
8152  }
8153
8154  /**
8155   * @param value {@link #type} (A finer grained suite of claim type codes which
8156   *              may convey additional information such as Inpatient vs
8157   *              Outpatient and/or a specialty service.)
8158   */
8159  public ClaimResponse setType(CodeableConcept value) {
8160    this.type = value;
8161    return this;
8162  }
8163
8164  /**
8165   * @return {@link #subType} (A finer grained suite of claim type codes which may
8166   *         convey additional information such as Inpatient vs Outpatient and/or
8167   *         a specialty service.)
8168   */
8169  public CodeableConcept getSubType() {
8170    if (this.subType == null)
8171      if (Configuration.errorOnAutoCreate())
8172        throw new Error("Attempt to auto-create ClaimResponse.subType");
8173      else if (Configuration.doAutoCreate())
8174        this.subType = new CodeableConcept(); // cc
8175    return this.subType;
8176  }
8177
8178  public boolean hasSubType() {
8179    return this.subType != null && !this.subType.isEmpty();
8180  }
8181
8182  /**
8183   * @param value {@link #subType} (A finer grained suite of claim type codes
8184   *              which may convey additional information such as Inpatient vs
8185   *              Outpatient and/or a specialty service.)
8186   */
8187  public ClaimResponse setSubType(CodeableConcept value) {
8188    this.subType = value;
8189    return this;
8190  }
8191
8192  /**
8193   * @return {@link #use} (A code to indicate whether the nature of the request
8194   *         is: to request adjudication of products and services previously
8195   *         rendered; or requesting authorization and adjudication for provision
8196   *         in the future; or requesting the non-binding adjudication of the
8197   *         listed products and services which could be provided in the future.).
8198   *         This is the underlying object with id, value and extensions. The
8199   *         accessor "getUse" gives direct access to the value
8200   */
8201  public Enumeration<Use> getUseElement() {
8202    if (this.use == null)
8203      if (Configuration.errorOnAutoCreate())
8204        throw new Error("Attempt to auto-create ClaimResponse.use");
8205      else if (Configuration.doAutoCreate())
8206        this.use = new Enumeration<Use>(new UseEnumFactory()); // bb
8207    return this.use;
8208  }
8209
8210  public boolean hasUseElement() {
8211    return this.use != null && !this.use.isEmpty();
8212  }
8213
8214  public boolean hasUse() {
8215    return this.use != null && !this.use.isEmpty();
8216  }
8217
8218  /**
8219   * @param value {@link #use} (A code to indicate whether the nature of the
8220   *              request is: to request adjudication of products and services
8221   *              previously rendered; or requesting authorization and
8222   *              adjudication for provision in the future; or requesting the
8223   *              non-binding adjudication of the listed products and services
8224   *              which could be provided in the future.). This is the underlying
8225   *              object with id, value and extensions. The accessor "getUse"
8226   *              gives direct access to the value
8227   */
8228  public ClaimResponse setUseElement(Enumeration<Use> value) {
8229    this.use = value;
8230    return this;
8231  }
8232
8233  /**
8234   * @return A code to indicate whether the nature of the request is: to request
8235   *         adjudication of products and services previously rendered; or
8236   *         requesting authorization and adjudication for provision in the
8237   *         future; or requesting the non-binding adjudication of the listed
8238   *         products and services which could be provided in the future.
8239   */
8240  public Use getUse() {
8241    return this.use == null ? null : this.use.getValue();
8242  }
8243
8244  /**
8245   * @param value A code to indicate whether the nature of the request is: to
8246   *              request adjudication of products and services previously
8247   *              rendered; or requesting authorization and adjudication for
8248   *              provision in the future; or requesting the non-binding
8249   *              adjudication of the listed products and services which could be
8250   *              provided in the future.
8251   */
8252  public ClaimResponse setUse(Use value) {
8253    if (this.use == null)
8254      this.use = new Enumeration<Use>(new UseEnumFactory());
8255    this.use.setValue(value);
8256    return this;
8257  }
8258
8259  /**
8260   * @return {@link #patient} (The party to whom the professional services and/or
8261   *         products have been supplied or are being considered and for whom
8262   *         actual for facast reimbursement is sought.)
8263   */
8264  public Reference getPatient() {
8265    if (this.patient == null)
8266      if (Configuration.errorOnAutoCreate())
8267        throw new Error("Attempt to auto-create ClaimResponse.patient");
8268      else if (Configuration.doAutoCreate())
8269        this.patient = new Reference(); // cc
8270    return this.patient;
8271  }
8272
8273  public boolean hasPatient() {
8274    return this.patient != null && !this.patient.isEmpty();
8275  }
8276
8277  /**
8278   * @param value {@link #patient} (The party to whom the professional services
8279   *              and/or products have been supplied or are being considered and
8280   *              for whom actual for facast reimbursement is sought.)
8281   */
8282  public ClaimResponse setPatient(Reference value) {
8283    this.patient = value;
8284    return this;
8285  }
8286
8287  /**
8288   * @return {@link #patient} The actual object that is the target of the
8289   *         reference. The reference library doesn't populate this, but you can
8290   *         use it to hold the resource if you resolve it. (The party to whom the
8291   *         professional services and/or products have been supplied or are being
8292   *         considered and for whom actual for facast reimbursement is sought.)
8293   */
8294  public Patient getPatientTarget() {
8295    if (this.patientTarget == null)
8296      if (Configuration.errorOnAutoCreate())
8297        throw new Error("Attempt to auto-create ClaimResponse.patient");
8298      else if (Configuration.doAutoCreate())
8299        this.patientTarget = new Patient(); // aa
8300    return this.patientTarget;
8301  }
8302
8303  /**
8304   * @param value {@link #patient} The actual object that is the target of the
8305   *              reference. The reference library doesn't use these, but you can
8306   *              use it to hold the resource if you resolve it. (The party to
8307   *              whom the professional services and/or products have been
8308   *              supplied or are being considered and for whom actual for facast
8309   *              reimbursement is sought.)
8310   */
8311  public ClaimResponse setPatientTarget(Patient value) {
8312    this.patientTarget = value;
8313    return this;
8314  }
8315
8316  /**
8317   * @return {@link #created} (The date this resource was created.). This is the
8318   *         underlying object with id, value and extensions. The accessor
8319   *         "getCreated" gives direct access to the value
8320   */
8321  public DateTimeType getCreatedElement() {
8322    if (this.created == null)
8323      if (Configuration.errorOnAutoCreate())
8324        throw new Error("Attempt to auto-create ClaimResponse.created");
8325      else if (Configuration.doAutoCreate())
8326        this.created = new DateTimeType(); // bb
8327    return this.created;
8328  }
8329
8330  public boolean hasCreatedElement() {
8331    return this.created != null && !this.created.isEmpty();
8332  }
8333
8334  public boolean hasCreated() {
8335    return this.created != null && !this.created.isEmpty();
8336  }
8337
8338  /**
8339   * @param value {@link #created} (The date this resource was created.). This is
8340   *              the underlying object with id, value and extensions. The
8341   *              accessor "getCreated" gives direct access to the value
8342   */
8343  public ClaimResponse setCreatedElement(DateTimeType value) {
8344    this.created = value;
8345    return this;
8346  }
8347
8348  /**
8349   * @return The date this resource was created.
8350   */
8351  public Date getCreated() {
8352    return this.created == null ? null : this.created.getValue();
8353  }
8354
8355  /**
8356   * @param value The date this resource was created.
8357   */
8358  public ClaimResponse setCreated(Date value) {
8359    if (this.created == null)
8360      this.created = new DateTimeType();
8361    this.created.setValue(value);
8362    return this;
8363  }
8364
8365  /**
8366   * @return {@link #insurer} (The party responsible for authorization,
8367   *         adjudication and reimbursement.)
8368   */
8369  public Reference getInsurer() {
8370    if (this.insurer == null)
8371      if (Configuration.errorOnAutoCreate())
8372        throw new Error("Attempt to auto-create ClaimResponse.insurer");
8373      else if (Configuration.doAutoCreate())
8374        this.insurer = new Reference(); // cc
8375    return this.insurer;
8376  }
8377
8378  public boolean hasInsurer() {
8379    return this.insurer != null && !this.insurer.isEmpty();
8380  }
8381
8382  /**
8383   * @param value {@link #insurer} (The party responsible for authorization,
8384   *              adjudication and reimbursement.)
8385   */
8386  public ClaimResponse setInsurer(Reference value) {
8387    this.insurer = value;
8388    return this;
8389  }
8390
8391  /**
8392   * @return {@link #insurer} The actual object that is the target of the
8393   *         reference. The reference library doesn't populate this, but you can
8394   *         use it to hold the resource if you resolve it. (The party responsible
8395   *         for authorization, adjudication and reimbursement.)
8396   */
8397  public Organization getInsurerTarget() {
8398    if (this.insurerTarget == null)
8399      if (Configuration.errorOnAutoCreate())
8400        throw new Error("Attempt to auto-create ClaimResponse.insurer");
8401      else if (Configuration.doAutoCreate())
8402        this.insurerTarget = new Organization(); // aa
8403    return this.insurerTarget;
8404  }
8405
8406  /**
8407   * @param value {@link #insurer} The actual object that is the target of the
8408   *              reference. The reference library doesn't use these, but you can
8409   *              use it to hold the resource if you resolve it. (The party
8410   *              responsible for authorization, adjudication and reimbursement.)
8411   */
8412  public ClaimResponse setInsurerTarget(Organization value) {
8413    this.insurerTarget = value;
8414    return this;
8415  }
8416
8417  /**
8418   * @return {@link #requestor} (The provider which is responsible for the claim,
8419   *         predetermination or preauthorization.)
8420   */
8421  public Reference getRequestor() {
8422    if (this.requestor == null)
8423      if (Configuration.errorOnAutoCreate())
8424        throw new Error("Attempt to auto-create ClaimResponse.requestor");
8425      else if (Configuration.doAutoCreate())
8426        this.requestor = new Reference(); // cc
8427    return this.requestor;
8428  }
8429
8430  public boolean hasRequestor() {
8431    return this.requestor != null && !this.requestor.isEmpty();
8432  }
8433
8434  /**
8435   * @param value {@link #requestor} (The provider which is responsible for the
8436   *              claim, predetermination or preauthorization.)
8437   */
8438  public ClaimResponse setRequestor(Reference value) {
8439    this.requestor = value;
8440    return this;
8441  }
8442
8443  /**
8444   * @return {@link #requestor} The actual object that is the target of the
8445   *         reference. The reference library doesn't populate this, but you can
8446   *         use it to hold the resource if you resolve it. (The provider which is
8447   *         responsible for the claim, predetermination or preauthorization.)
8448   */
8449  public Resource getRequestorTarget() {
8450    return this.requestorTarget;
8451  }
8452
8453  /**
8454   * @param value {@link #requestor} The actual object that is the target of the
8455   *              reference. The reference library doesn't use these, but you can
8456   *              use it to hold the resource if you resolve it. (The provider
8457   *              which is responsible for the claim, predetermination or
8458   *              preauthorization.)
8459   */
8460  public ClaimResponse setRequestorTarget(Resource value) {
8461    this.requestorTarget = value;
8462    return this;
8463  }
8464
8465  /**
8466   * @return {@link #request} (Original request resource reference.)
8467   */
8468  public Reference getRequest() {
8469    if (this.request == null)
8470      if (Configuration.errorOnAutoCreate())
8471        throw new Error("Attempt to auto-create ClaimResponse.request");
8472      else if (Configuration.doAutoCreate())
8473        this.request = new Reference(); // cc
8474    return this.request;
8475  }
8476
8477  public boolean hasRequest() {
8478    return this.request != null && !this.request.isEmpty();
8479  }
8480
8481  /**
8482   * @param value {@link #request} (Original request resource reference.)
8483   */
8484  public ClaimResponse setRequest(Reference value) {
8485    this.request = value;
8486    return this;
8487  }
8488
8489  /**
8490   * @return {@link #request} The actual object that is the target of the
8491   *         reference. The reference library doesn't populate this, but you can
8492   *         use it to hold the resource if you resolve it. (Original request
8493   *         resource reference.)
8494   */
8495  public Claim getRequestTarget() {
8496    if (this.requestTarget == null)
8497      if (Configuration.errorOnAutoCreate())
8498        throw new Error("Attempt to auto-create ClaimResponse.request");
8499      else if (Configuration.doAutoCreate())
8500        this.requestTarget = new Claim(); // aa
8501    return this.requestTarget;
8502  }
8503
8504  /**
8505   * @param value {@link #request} The actual object that is the target of the
8506   *              reference. The reference library doesn't use these, but you can
8507   *              use it to hold the resource if you resolve it. (Original request
8508   *              resource reference.)
8509   */
8510  public ClaimResponse setRequestTarget(Claim value) {
8511    this.requestTarget = value;
8512    return this;
8513  }
8514
8515  /**
8516   * @return {@link #outcome} (The outcome of the claim, predetermination, or
8517   *         preauthorization processing.). This is the underlying object with id,
8518   *         value and extensions. The accessor "getOutcome" gives direct access
8519   *         to the value
8520   */
8521  public Enumeration<RemittanceOutcome> getOutcomeElement() {
8522    if (this.outcome == null)
8523      if (Configuration.errorOnAutoCreate())
8524        throw new Error("Attempt to auto-create ClaimResponse.outcome");
8525      else if (Configuration.doAutoCreate())
8526        this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
8527    return this.outcome;
8528  }
8529
8530  public boolean hasOutcomeElement() {
8531    return this.outcome != null && !this.outcome.isEmpty();
8532  }
8533
8534  public boolean hasOutcome() {
8535    return this.outcome != null && !this.outcome.isEmpty();
8536  }
8537
8538  /**
8539   * @param value {@link #outcome} (The outcome of the claim, predetermination, or
8540   *              preauthorization processing.). This is the underlying object
8541   *              with id, value and extensions. The accessor "getOutcome" gives
8542   *              direct access to the value
8543   */
8544  public ClaimResponse setOutcomeElement(Enumeration<RemittanceOutcome> value) {
8545    this.outcome = value;
8546    return this;
8547  }
8548
8549  /**
8550   * @return The outcome of the claim, predetermination, or preauthorization
8551   *         processing.
8552   */
8553  public RemittanceOutcome getOutcome() {
8554    return this.outcome == null ? null : this.outcome.getValue();
8555  }
8556
8557  /**
8558   * @param value The outcome of the claim, predetermination, or preauthorization
8559   *              processing.
8560   */
8561  public ClaimResponse setOutcome(RemittanceOutcome value) {
8562    if (this.outcome == null)
8563      this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
8564    this.outcome.setValue(value);
8565    return this;
8566  }
8567
8568  /**
8569   * @return {@link #disposition} (A human readable description of the status of
8570   *         the adjudication.). This is the underlying object with id, value and
8571   *         extensions. The accessor "getDisposition" gives direct access to the
8572   *         value
8573   */
8574  public StringType getDispositionElement() {
8575    if (this.disposition == null)
8576      if (Configuration.errorOnAutoCreate())
8577        throw new Error("Attempt to auto-create ClaimResponse.disposition");
8578      else if (Configuration.doAutoCreate())
8579        this.disposition = new StringType(); // bb
8580    return this.disposition;
8581  }
8582
8583  public boolean hasDispositionElement() {
8584    return this.disposition != null && !this.disposition.isEmpty();
8585  }
8586
8587  public boolean hasDisposition() {
8588    return this.disposition != null && !this.disposition.isEmpty();
8589  }
8590
8591  /**
8592   * @param value {@link #disposition} (A human readable description of the status
8593   *              of the adjudication.). This is the underlying object with id,
8594   *              value and extensions. The accessor "getDisposition" gives direct
8595   *              access to the value
8596   */
8597  public ClaimResponse setDispositionElement(StringType value) {
8598    this.disposition = value;
8599    return this;
8600  }
8601
8602  /**
8603   * @return A human readable description of the status of the adjudication.
8604   */
8605  public String getDisposition() {
8606    return this.disposition == null ? null : this.disposition.getValue();
8607  }
8608
8609  /**
8610   * @param value A human readable description of the status of the adjudication.
8611   */
8612  public ClaimResponse setDisposition(String value) {
8613    if (Utilities.noString(value))
8614      this.disposition = null;
8615    else {
8616      if (this.disposition == null)
8617        this.disposition = new StringType();
8618      this.disposition.setValue(value);
8619    }
8620    return this;
8621  }
8622
8623  /**
8624   * @return {@link #preAuthRef} (Reference from the Insurer which is used in
8625   *         later communications which refers to this adjudication.). This is the
8626   *         underlying object with id, value and extensions. The accessor
8627   *         "getPreAuthRef" gives direct access to the value
8628   */
8629  public StringType getPreAuthRefElement() {
8630    if (this.preAuthRef == null)
8631      if (Configuration.errorOnAutoCreate())
8632        throw new Error("Attempt to auto-create ClaimResponse.preAuthRef");
8633      else if (Configuration.doAutoCreate())
8634        this.preAuthRef = new StringType(); // bb
8635    return this.preAuthRef;
8636  }
8637
8638  public boolean hasPreAuthRefElement() {
8639    return this.preAuthRef != null && !this.preAuthRef.isEmpty();
8640  }
8641
8642  public boolean hasPreAuthRef() {
8643    return this.preAuthRef != null && !this.preAuthRef.isEmpty();
8644  }
8645
8646  /**
8647   * @param value {@link #preAuthRef} (Reference from the Insurer which is used in
8648   *              later communications which refers to this adjudication.). This
8649   *              is the underlying object with id, value and extensions. The
8650   *              accessor "getPreAuthRef" gives direct access to the value
8651   */
8652  public ClaimResponse setPreAuthRefElement(StringType value) {
8653    this.preAuthRef = value;
8654    return this;
8655  }
8656
8657  /**
8658   * @return Reference from the Insurer which is used in later communications
8659   *         which refers to this adjudication.
8660   */
8661  public String getPreAuthRef() {
8662    return this.preAuthRef == null ? null : this.preAuthRef.getValue();
8663  }
8664
8665  /**
8666   * @param value Reference from the Insurer which is used in later communications
8667   *              which refers to this adjudication.
8668   */
8669  public ClaimResponse setPreAuthRef(String value) {
8670    if (Utilities.noString(value))
8671      this.preAuthRef = null;
8672    else {
8673      if (this.preAuthRef == null)
8674        this.preAuthRef = new StringType();
8675      this.preAuthRef.setValue(value);
8676    }
8677    return this;
8678  }
8679
8680  /**
8681   * @return {@link #preAuthPeriod} (The time frame during which this
8682   *         authorization is effective.)
8683   */
8684  public Period getPreAuthPeriod() {
8685    if (this.preAuthPeriod == null)
8686      if (Configuration.errorOnAutoCreate())
8687        throw new Error("Attempt to auto-create ClaimResponse.preAuthPeriod");
8688      else if (Configuration.doAutoCreate())
8689        this.preAuthPeriod = new Period(); // cc
8690    return this.preAuthPeriod;
8691  }
8692
8693  public boolean hasPreAuthPeriod() {
8694    return this.preAuthPeriod != null && !this.preAuthPeriod.isEmpty();
8695  }
8696
8697  /**
8698   * @param value {@link #preAuthPeriod} (The time frame during which this
8699   *              authorization is effective.)
8700   */
8701  public ClaimResponse setPreAuthPeriod(Period value) {
8702    this.preAuthPeriod = value;
8703    return this;
8704  }
8705
8706  /**
8707   * @return {@link #payeeType} (Type of Party to be reimbursed: subscriber,
8708   *         provider, other.)
8709   */
8710  public CodeableConcept getPayeeType() {
8711    if (this.payeeType == null)
8712      if (Configuration.errorOnAutoCreate())
8713        throw new Error("Attempt to auto-create ClaimResponse.payeeType");
8714      else if (Configuration.doAutoCreate())
8715        this.payeeType = new CodeableConcept(); // cc
8716    return this.payeeType;
8717  }
8718
8719  public boolean hasPayeeType() {
8720    return this.payeeType != null && !this.payeeType.isEmpty();
8721  }
8722
8723  /**
8724   * @param value {@link #payeeType} (Type of Party to be reimbursed: subscriber,
8725   *              provider, other.)
8726   */
8727  public ClaimResponse setPayeeType(CodeableConcept value) {
8728    this.payeeType = value;
8729    return this;
8730  }
8731
8732  /**
8733   * @return {@link #item} (A claim line. Either a simple (a product or service)
8734   *         or a 'group' of details which can also be a simple items or groups of
8735   *         sub-details.)
8736   */
8737  public List<ItemComponent> getItem() {
8738    if (this.item == null)
8739      this.item = new ArrayList<ItemComponent>();
8740    return this.item;
8741  }
8742
8743  /**
8744   * @return Returns a reference to <code>this</code> for easy method chaining
8745   */
8746  public ClaimResponse setItem(List<ItemComponent> theItem) {
8747    this.item = theItem;
8748    return this;
8749  }
8750
8751  public boolean hasItem() {
8752    if (this.item == null)
8753      return false;
8754    for (ItemComponent item : this.item)
8755      if (!item.isEmpty())
8756        return true;
8757    return false;
8758  }
8759
8760  public ItemComponent addItem() { // 3
8761    ItemComponent t = new ItemComponent();
8762    if (this.item == null)
8763      this.item = new ArrayList<ItemComponent>();
8764    this.item.add(t);
8765    return t;
8766  }
8767
8768  public ClaimResponse addItem(ItemComponent t) { // 3
8769    if (t == null)
8770      return this;
8771    if (this.item == null)
8772      this.item = new ArrayList<ItemComponent>();
8773    this.item.add(t);
8774    return this;
8775  }
8776
8777  /**
8778   * @return The first repetition of repeating field {@link #item}, creating it if
8779   *         it does not already exist
8780   */
8781  public ItemComponent getItemFirstRep() {
8782    if (getItem().isEmpty()) {
8783      addItem();
8784    }
8785    return getItem().get(0);
8786  }
8787
8788  /**
8789   * @return {@link #addItem} (The first-tier service adjudications for payor
8790   *         added product or service lines.)
8791   */
8792  public List<AddedItemComponent> getAddItem() {
8793    if (this.addItem == null)
8794      this.addItem = new ArrayList<AddedItemComponent>();
8795    return this.addItem;
8796  }
8797
8798  /**
8799   * @return Returns a reference to <code>this</code> for easy method chaining
8800   */
8801  public ClaimResponse setAddItem(List<AddedItemComponent> theAddItem) {
8802    this.addItem = theAddItem;
8803    return this;
8804  }
8805
8806  public boolean hasAddItem() {
8807    if (this.addItem == null)
8808      return false;
8809    for (AddedItemComponent item : this.addItem)
8810      if (!item.isEmpty())
8811        return true;
8812    return false;
8813  }
8814
8815  public AddedItemComponent addAddItem() { // 3
8816    AddedItemComponent t = new AddedItemComponent();
8817    if (this.addItem == null)
8818      this.addItem = new ArrayList<AddedItemComponent>();
8819    this.addItem.add(t);
8820    return t;
8821  }
8822
8823  public ClaimResponse addAddItem(AddedItemComponent t) { // 3
8824    if (t == null)
8825      return this;
8826    if (this.addItem == null)
8827      this.addItem = new ArrayList<AddedItemComponent>();
8828    this.addItem.add(t);
8829    return this;
8830  }
8831
8832  /**
8833   * @return The first repetition of repeating field {@link #addItem}, creating it
8834   *         if it does not already exist
8835   */
8836  public AddedItemComponent getAddItemFirstRep() {
8837    if (getAddItem().isEmpty()) {
8838      addAddItem();
8839    }
8840    return getAddItem().get(0);
8841  }
8842
8843  /**
8844   * @return {@link #adjudication} (The adjudication results which are presented
8845   *         at the header level rather than at the line-item or add-item levels.)
8846   */
8847  public List<AdjudicationComponent> getAdjudication() {
8848    if (this.adjudication == null)
8849      this.adjudication = new ArrayList<AdjudicationComponent>();
8850    return this.adjudication;
8851  }
8852
8853  /**
8854   * @return Returns a reference to <code>this</code> for easy method chaining
8855   */
8856  public ClaimResponse setAdjudication(List<AdjudicationComponent> theAdjudication) {
8857    this.adjudication = theAdjudication;
8858    return this;
8859  }
8860
8861  public boolean hasAdjudication() {
8862    if (this.adjudication == null)
8863      return false;
8864    for (AdjudicationComponent item : this.adjudication)
8865      if (!item.isEmpty())
8866        return true;
8867    return false;
8868  }
8869
8870  public AdjudicationComponent addAdjudication() { // 3
8871    AdjudicationComponent t = new AdjudicationComponent();
8872    if (this.adjudication == null)
8873      this.adjudication = new ArrayList<AdjudicationComponent>();
8874    this.adjudication.add(t);
8875    return t;
8876  }
8877
8878  public ClaimResponse addAdjudication(AdjudicationComponent t) { // 3
8879    if (t == null)
8880      return this;
8881    if (this.adjudication == null)
8882      this.adjudication = new ArrayList<AdjudicationComponent>();
8883    this.adjudication.add(t);
8884    return this;
8885  }
8886
8887  /**
8888   * @return The first repetition of repeating field {@link #adjudication},
8889   *         creating it if it does not already exist
8890   */
8891  public AdjudicationComponent getAdjudicationFirstRep() {
8892    if (getAdjudication().isEmpty()) {
8893      addAdjudication();
8894    }
8895    return getAdjudication().get(0);
8896  }
8897
8898  /**
8899   * @return {@link #total} (Categorized monetary totals for the adjudication.)
8900   */
8901  public List<TotalComponent> getTotal() {
8902    if (this.total == null)
8903      this.total = new ArrayList<TotalComponent>();
8904    return this.total;
8905  }
8906
8907  /**
8908   * @return Returns a reference to <code>this</code> for easy method chaining
8909   */
8910  public ClaimResponse setTotal(List<TotalComponent> theTotal) {
8911    this.total = theTotal;
8912    return this;
8913  }
8914
8915  public boolean hasTotal() {
8916    if (this.total == null)
8917      return false;
8918    for (TotalComponent item : this.total)
8919      if (!item.isEmpty())
8920        return true;
8921    return false;
8922  }
8923
8924  public TotalComponent addTotal() { // 3
8925    TotalComponent t = new TotalComponent();
8926    if (this.total == null)
8927      this.total = new ArrayList<TotalComponent>();
8928    this.total.add(t);
8929    return t;
8930  }
8931
8932  public ClaimResponse addTotal(TotalComponent t) { // 3
8933    if (t == null)
8934      return this;
8935    if (this.total == null)
8936      this.total = new ArrayList<TotalComponent>();
8937    this.total.add(t);
8938    return this;
8939  }
8940
8941  /**
8942   * @return The first repetition of repeating field {@link #total}, creating it
8943   *         if it does not already exist
8944   */
8945  public TotalComponent getTotalFirstRep() {
8946    if (getTotal().isEmpty()) {
8947      addTotal();
8948    }
8949    return getTotal().get(0);
8950  }
8951
8952  /**
8953   * @return {@link #payment} (Payment details for the adjudication of the claim.)
8954   */
8955  public PaymentComponent getPayment() {
8956    if (this.payment == null)
8957      if (Configuration.errorOnAutoCreate())
8958        throw new Error("Attempt to auto-create ClaimResponse.payment");
8959      else if (Configuration.doAutoCreate())
8960        this.payment = new PaymentComponent(); // cc
8961    return this.payment;
8962  }
8963
8964  public boolean hasPayment() {
8965    return this.payment != null && !this.payment.isEmpty();
8966  }
8967
8968  /**
8969   * @param value {@link #payment} (Payment details for the adjudication of the
8970   *              claim.)
8971   */
8972  public ClaimResponse setPayment(PaymentComponent value) {
8973    this.payment = value;
8974    return this;
8975  }
8976
8977  /**
8978   * @return {@link #fundsReserve} (A code, used only on a response to a
8979   *         preauthorization, to indicate whether the benefits payable have been
8980   *         reserved and for whom.)
8981   */
8982  public CodeableConcept getFundsReserve() {
8983    if (this.fundsReserve == null)
8984      if (Configuration.errorOnAutoCreate())
8985        throw new Error("Attempt to auto-create ClaimResponse.fundsReserve");
8986      else if (Configuration.doAutoCreate())
8987        this.fundsReserve = new CodeableConcept(); // cc
8988    return this.fundsReserve;
8989  }
8990
8991  public boolean hasFundsReserve() {
8992    return this.fundsReserve != null && !this.fundsReserve.isEmpty();
8993  }
8994
8995  /**
8996   * @param value {@link #fundsReserve} (A code, used only on a response to a
8997   *              preauthorization, to indicate whether the benefits payable have
8998   *              been reserved and for whom.)
8999   */
9000  public ClaimResponse setFundsReserve(CodeableConcept value) {
9001    this.fundsReserve = value;
9002    return this;
9003  }
9004
9005  /**
9006   * @return {@link #formCode} (A code for the form to be used for printing the
9007   *         content.)
9008   */
9009  public CodeableConcept getFormCode() {
9010    if (this.formCode == null)
9011      if (Configuration.errorOnAutoCreate())
9012        throw new Error("Attempt to auto-create ClaimResponse.formCode");
9013      else if (Configuration.doAutoCreate())
9014        this.formCode = new CodeableConcept(); // cc
9015    return this.formCode;
9016  }
9017
9018  public boolean hasFormCode() {
9019    return this.formCode != null && !this.formCode.isEmpty();
9020  }
9021
9022  /**
9023   * @param value {@link #formCode} (A code for the form to be used for printing
9024   *              the content.)
9025   */
9026  public ClaimResponse setFormCode(CodeableConcept value) {
9027    this.formCode = value;
9028    return this;
9029  }
9030
9031  /**
9032   * @return {@link #form} (The actual form, by reference or inclusion, for
9033   *         printing the content or an EOB.)
9034   */
9035  public Attachment getForm() {
9036    if (this.form == null)
9037      if (Configuration.errorOnAutoCreate())
9038        throw new Error("Attempt to auto-create ClaimResponse.form");
9039      else if (Configuration.doAutoCreate())
9040        this.form = new Attachment(); // cc
9041    return this.form;
9042  }
9043
9044  public boolean hasForm() {
9045    return this.form != null && !this.form.isEmpty();
9046  }
9047
9048  /**
9049   * @param value {@link #form} (The actual form, by reference or inclusion, for
9050   *              printing the content or an EOB.)
9051   */
9052  public ClaimResponse setForm(Attachment value) {
9053    this.form = value;
9054    return this;
9055  }
9056
9057  /**
9058   * @return {@link #processNote} (A note that describes or explains adjudication
9059   *         results in a human readable form.)
9060   */
9061  public List<NoteComponent> getProcessNote() {
9062    if (this.processNote == null)
9063      this.processNote = new ArrayList<NoteComponent>();
9064    return this.processNote;
9065  }
9066
9067  /**
9068   * @return Returns a reference to <code>this</code> for easy method chaining
9069   */
9070  public ClaimResponse setProcessNote(List<NoteComponent> theProcessNote) {
9071    this.processNote = theProcessNote;
9072    return this;
9073  }
9074
9075  public boolean hasProcessNote() {
9076    if (this.processNote == null)
9077      return false;
9078    for (NoteComponent item : this.processNote)
9079      if (!item.isEmpty())
9080        return true;
9081    return false;
9082  }
9083
9084  public NoteComponent addProcessNote() { // 3
9085    NoteComponent t = new NoteComponent();
9086    if (this.processNote == null)
9087      this.processNote = new ArrayList<NoteComponent>();
9088    this.processNote.add(t);
9089    return t;
9090  }
9091
9092  public ClaimResponse addProcessNote(NoteComponent t) { // 3
9093    if (t == null)
9094      return this;
9095    if (this.processNote == null)
9096      this.processNote = new ArrayList<NoteComponent>();
9097    this.processNote.add(t);
9098    return this;
9099  }
9100
9101  /**
9102   * @return The first repetition of repeating field {@link #processNote},
9103   *         creating it if it does not already exist
9104   */
9105  public NoteComponent getProcessNoteFirstRep() {
9106    if (getProcessNote().isEmpty()) {
9107      addProcessNote();
9108    }
9109    return getProcessNote().get(0);
9110  }
9111
9112  /**
9113   * @return {@link #communicationRequest} (Request for additional supporting or
9114   *         authorizing information.)
9115   */
9116  public List<Reference> getCommunicationRequest() {
9117    if (this.communicationRequest == null)
9118      this.communicationRequest = new ArrayList<Reference>();
9119    return this.communicationRequest;
9120  }
9121
9122  /**
9123   * @return Returns a reference to <code>this</code> for easy method chaining
9124   */
9125  public ClaimResponse setCommunicationRequest(List<Reference> theCommunicationRequest) {
9126    this.communicationRequest = theCommunicationRequest;
9127    return this;
9128  }
9129
9130  public boolean hasCommunicationRequest() {
9131    if (this.communicationRequest == null)
9132      return false;
9133    for (Reference item : this.communicationRequest)
9134      if (!item.isEmpty())
9135        return true;
9136    return false;
9137  }
9138
9139  public Reference addCommunicationRequest() { // 3
9140    Reference t = new Reference();
9141    if (this.communicationRequest == null)
9142      this.communicationRequest = new ArrayList<Reference>();
9143    this.communicationRequest.add(t);
9144    return t;
9145  }
9146
9147  public ClaimResponse addCommunicationRequest(Reference t) { // 3
9148    if (t == null)
9149      return this;
9150    if (this.communicationRequest == null)
9151      this.communicationRequest = new ArrayList<Reference>();
9152    this.communicationRequest.add(t);
9153    return this;
9154  }
9155
9156  /**
9157   * @return The first repetition of repeating field
9158   *         {@link #communicationRequest}, creating it if it does not already
9159   *         exist
9160   */
9161  public Reference getCommunicationRequestFirstRep() {
9162    if (getCommunicationRequest().isEmpty()) {
9163      addCommunicationRequest();
9164    }
9165    return getCommunicationRequest().get(0);
9166  }
9167
9168  /**
9169   * @deprecated Use Reference#setResource(IBaseResource) instead
9170   */
9171  @Deprecated
9172  public List<CommunicationRequest> getCommunicationRequestTarget() {
9173    if (this.communicationRequestTarget == null)
9174      this.communicationRequestTarget = new ArrayList<CommunicationRequest>();
9175    return this.communicationRequestTarget;
9176  }
9177
9178  /**
9179   * @deprecated Use Reference#setResource(IBaseResource) instead
9180   */
9181  @Deprecated
9182  public CommunicationRequest addCommunicationRequestTarget() {
9183    CommunicationRequest r = new CommunicationRequest();
9184    if (this.communicationRequestTarget == null)
9185      this.communicationRequestTarget = new ArrayList<CommunicationRequest>();
9186    this.communicationRequestTarget.add(r);
9187    return r;
9188  }
9189
9190  /**
9191   * @return {@link #insurance} (Financial instruments for reimbursement for the
9192   *         health care products and services specified on the claim.)
9193   */
9194  public List<InsuranceComponent> getInsurance() {
9195    if (this.insurance == null)
9196      this.insurance = new ArrayList<InsuranceComponent>();
9197    return this.insurance;
9198  }
9199
9200  /**
9201   * @return Returns a reference to <code>this</code> for easy method chaining
9202   */
9203  public ClaimResponse setInsurance(List<InsuranceComponent> theInsurance) {
9204    this.insurance = theInsurance;
9205    return this;
9206  }
9207
9208  public boolean hasInsurance() {
9209    if (this.insurance == null)
9210      return false;
9211    for (InsuranceComponent item : this.insurance)
9212      if (!item.isEmpty())
9213        return true;
9214    return false;
9215  }
9216
9217  public InsuranceComponent addInsurance() { // 3
9218    InsuranceComponent t = new InsuranceComponent();
9219    if (this.insurance == null)
9220      this.insurance = new ArrayList<InsuranceComponent>();
9221    this.insurance.add(t);
9222    return t;
9223  }
9224
9225  public ClaimResponse addInsurance(InsuranceComponent t) { // 3
9226    if (t == null)
9227      return this;
9228    if (this.insurance == null)
9229      this.insurance = new ArrayList<InsuranceComponent>();
9230    this.insurance.add(t);
9231    return this;
9232  }
9233
9234  /**
9235   * @return The first repetition of repeating field {@link #insurance}, creating
9236   *         it if it does not already exist
9237   */
9238  public InsuranceComponent getInsuranceFirstRep() {
9239    if (getInsurance().isEmpty()) {
9240      addInsurance();
9241    }
9242    return getInsurance().get(0);
9243  }
9244
9245  /**
9246   * @return {@link #error} (Errors encountered during the processing of the
9247   *         adjudication.)
9248   */
9249  public List<ErrorComponent> getError() {
9250    if (this.error == null)
9251      this.error = new ArrayList<ErrorComponent>();
9252    return this.error;
9253  }
9254
9255  /**
9256   * @return Returns a reference to <code>this</code> for easy method chaining
9257   */
9258  public ClaimResponse setError(List<ErrorComponent> theError) {
9259    this.error = theError;
9260    return this;
9261  }
9262
9263  public boolean hasError() {
9264    if (this.error == null)
9265      return false;
9266    for (ErrorComponent item : this.error)
9267      if (!item.isEmpty())
9268        return true;
9269    return false;
9270  }
9271
9272  public ErrorComponent addError() { // 3
9273    ErrorComponent t = new ErrorComponent();
9274    if (this.error == null)
9275      this.error = new ArrayList<ErrorComponent>();
9276    this.error.add(t);
9277    return t;
9278  }
9279
9280  public ClaimResponse addError(ErrorComponent t) { // 3
9281    if (t == null)
9282      return this;
9283    if (this.error == null)
9284      this.error = new ArrayList<ErrorComponent>();
9285    this.error.add(t);
9286    return this;
9287  }
9288
9289  /**
9290   * @return The first repetition of repeating field {@link #error}, creating it
9291   *         if it does not already exist
9292   */
9293  public ErrorComponent getErrorFirstRep() {
9294    if (getError().isEmpty()) {
9295      addError();
9296    }
9297    return getError().get(0);
9298  }
9299
9300  protected void listChildren(List<Property> children) {
9301    super.listChildren(children);
9302    children.add(new Property("identifier", "Identifier", "A unique identifier assigned to this claim response.", 0,
9303        java.lang.Integer.MAX_VALUE, identifier));
9304    children.add(new Property("status", "code", "The status of the resource instance.", 0, 1, status));
9305    children.add(new Property("type", "CodeableConcept",
9306        "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
9307        0, 1, type));
9308    children.add(new Property("subType", "CodeableConcept",
9309        "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
9310        0, 1, subType));
9311    children.add(new Property("use", "code",
9312        "A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.",
9313        0, 1, use));
9314    children.add(new Property("patient", "Reference(Patient)",
9315        "The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for facast reimbursement is sought.",
9316        0, 1, patient));
9317    children.add(new Property("created", "dateTime", "The date this resource was created.", 0, 1, created));
9318    children.add(new Property("insurer", "Reference(Organization)",
9319        "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer));
9320    children.add(new Property("requestor", "Reference(Practitioner|PractitionerRole|Organization)",
9321        "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, requestor));
9322    children.add(new Property("request", "Reference(Claim)", "Original request resource reference.", 0, 1, request));
9323    children.add(new Property("outcome", "code",
9324        "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome));
9325    children.add(new Property("disposition", "string",
9326        "A human readable description of the status of the adjudication.", 0, 1, disposition));
9327    children.add(new Property("preAuthRef", "string",
9328        "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0, 1,
9329        preAuthRef));
9330    children.add(new Property("preAuthPeriod", "Period", "The time frame during which this authorization is effective.",
9331        0, 1, preAuthPeriod));
9332    children.add(new Property("payeeType", "CodeableConcept",
9333        "Type of Party to be reimbursed: subscriber, provider, other.", 0, 1, payeeType));
9334    children.add(new Property("item", "",
9335        "A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.",
9336        0, java.lang.Integer.MAX_VALUE, item));
9337    children.add(
9338        new Property("addItem", "", "The first-tier service adjudications for payor added product or service lines.", 0,
9339            java.lang.Integer.MAX_VALUE, addItem));
9340    children.add(new Property("adjudication", "@ClaimResponse.item.adjudication",
9341        "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.",
9342        0, java.lang.Integer.MAX_VALUE, adjudication));
9343    children.add(new Property("total", "", "Categorized monetary totals for the adjudication.", 0,
9344        java.lang.Integer.MAX_VALUE, total));
9345    children.add(new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1, payment));
9346    children.add(new Property("fundsReserve", "CodeableConcept",
9347        "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.",
9348        0, 1, fundsReserve));
9349    children.add(new Property("formCode", "CodeableConcept", "A code for the form to be used for printing the content.",
9350        0, 1, formCode));
9351    children.add(new Property("form", "Attachment",
9352        "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form));
9353    children.add(new Property("processNote", "",
9354        "A note that describes or explains adjudication results in a human readable form.", 0,
9355        java.lang.Integer.MAX_VALUE, processNote));
9356    children.add(new Property("communicationRequest", "Reference(CommunicationRequest)",
9357        "Request for additional supporting or authorizing information.", 0, java.lang.Integer.MAX_VALUE,
9358        communicationRequest));
9359    children.add(new Property("insurance", "",
9360        "Financial instruments for reimbursement for the health care products and services specified on the claim.", 0,
9361        java.lang.Integer.MAX_VALUE, insurance));
9362    children.add(new Property("error", "", "Errors encountered during the processing of the adjudication.", 0,
9363        java.lang.Integer.MAX_VALUE, error));
9364  }
9365
9366  @Override
9367  public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException {
9368    switch (_hash) {
9369    case -1618432855:
9370      /* identifier */ return new Property("identifier", "Identifier",
9371          "A unique identifier assigned to this claim response.", 0, java.lang.Integer.MAX_VALUE, identifier);
9372    case -892481550:
9373      /* status */ return new Property("status", "code", "The status of the resource instance.", 0, 1, status);
9374    case 3575610:
9375      /* type */ return new Property("type", "CodeableConcept",
9376          "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
9377          0, 1, type);
9378    case -1868521062:
9379      /* subType */ return new Property("subType", "CodeableConcept",
9380          "A finer grained suite of claim type codes which may convey additional information such as Inpatient vs Outpatient and/or a specialty service.",
9381          0, 1, subType);
9382    case 116103:
9383      /* use */ return new Property("use", "code",
9384          "A code to indicate whether the nature of the request is: to request adjudication of products and services previously rendered; or requesting authorization and adjudication for provision in the future; or requesting the non-binding adjudication of the listed products and services which could be provided in the future.",
9385          0, 1, use);
9386    case -791418107:
9387      /* patient */ return new Property("patient", "Reference(Patient)",
9388          "The party to whom the professional services and/or products have been supplied or are being considered and for whom actual for facast reimbursement is sought.",
9389          0, 1, patient);
9390    case 1028554472:
9391      /* created */ return new Property("created", "dateTime", "The date this resource was created.", 0, 1, created);
9392    case 1957615864:
9393      /* insurer */ return new Property("insurer", "Reference(Organization)",
9394          "The party responsible for authorization, adjudication and reimbursement.", 0, 1, insurer);
9395    case 693934258:
9396      /* requestor */ return new Property("requestor", "Reference(Practitioner|PractitionerRole|Organization)",
9397          "The provider which is responsible for the claim, predetermination or preauthorization.", 0, 1, requestor);
9398    case 1095692943:
9399      /* request */ return new Property("request", "Reference(Claim)", "Original request resource reference.", 0, 1,
9400          request);
9401    case -1106507950:
9402      /* outcome */ return new Property("outcome", "code",
9403          "The outcome of the claim, predetermination, or preauthorization processing.", 0, 1, outcome);
9404    case 583380919:
9405      /* disposition */ return new Property("disposition", "string",
9406          "A human readable description of the status of the adjudication.", 0, 1, disposition);
9407    case 522246568:
9408      /* preAuthRef */ return new Property("preAuthRef", "string",
9409          "Reference from the Insurer which is used in later communications which refers to this adjudication.", 0, 1,
9410          preAuthRef);
9411    case 1819164812:
9412      /* preAuthPeriod */ return new Property("preAuthPeriod", "Period",
9413          "The time frame during which this authorization is effective.", 0, 1, preAuthPeriod);
9414    case -316321118:
9415      /* payeeType */ return new Property("payeeType", "CodeableConcept",
9416          "Type of Party to be reimbursed: subscriber, provider, other.", 0, 1, payeeType);
9417    case 3242771:
9418      /* item */ return new Property("item", "",
9419          "A claim line. Either a simple (a product or service) or a 'group' of details which can also be a simple items or groups of sub-details.",
9420          0, java.lang.Integer.MAX_VALUE, item);
9421    case -1148899500:
9422      /* addItem */ return new Property("addItem", "",
9423          "The first-tier service adjudications for payor added product or service lines.", 0,
9424          java.lang.Integer.MAX_VALUE, addItem);
9425    case -231349275:
9426      /* adjudication */ return new Property("adjudication", "@ClaimResponse.item.adjudication",
9427          "The adjudication results which are presented at the header level rather than at the line-item or add-item levels.",
9428          0, java.lang.Integer.MAX_VALUE, adjudication);
9429    case 110549828:
9430      /* total */ return new Property("total", "", "Categorized monetary totals for the adjudication.", 0,
9431          java.lang.Integer.MAX_VALUE, total);
9432    case -786681338:
9433      /* payment */ return new Property("payment", "", "Payment details for the adjudication of the claim.", 0, 1,
9434          payment);
9435    case 1314609806:
9436      /* fundsReserve */ return new Property("fundsReserve", "CodeableConcept",
9437          "A code, used only on a response to a preauthorization, to indicate whether the benefits payable have been reserved and for whom.",
9438          0, 1, fundsReserve);
9439    case 473181393:
9440      /* formCode */ return new Property("formCode", "CodeableConcept",
9441          "A code for the form to be used for printing the content.", 0, 1, formCode);
9442    case 3148996:
9443      /* form */ return new Property("form", "Attachment",
9444          "The actual form, by reference or inclusion, for printing the content or an EOB.", 0, 1, form);
9445    case 202339073:
9446      /* processNote */ return new Property("processNote", "",
9447          "A note that describes or explains adjudication results in a human readable form.", 0,
9448          java.lang.Integer.MAX_VALUE, processNote);
9449    case -2071896615:
9450      /* communicationRequest */ return new Property("communicationRequest", "Reference(CommunicationRequest)",
9451          "Request for additional supporting or authorizing information.", 0, java.lang.Integer.MAX_VALUE,
9452          communicationRequest);
9453    case 73049818:
9454      /* insurance */ return new Property("insurance", "",
9455          "Financial instruments for reimbursement for the health care products and services specified on the claim.",
9456          0, java.lang.Integer.MAX_VALUE, insurance);
9457    case 96784904:
9458      /* error */ return new Property("error", "", "Errors encountered during the processing of the adjudication.", 0,
9459          java.lang.Integer.MAX_VALUE, error);
9460    default:
9461      return super.getNamedProperty(_hash, _name, _checkValid);
9462    }
9463
9464  }
9465
9466  @Override
9467  public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
9468    switch (hash) {
9469    case -1618432855:
9470      /* identifier */ return this.identifier == null ? new Base[0]
9471          : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
9472    case -892481550:
9473      /* status */ return this.status == null ? new Base[0] : new Base[] { this.status }; // Enumeration<ClaimResponseStatus>
9474    case 3575610:
9475      /* type */ return this.type == null ? new Base[0] : new Base[] { this.type }; // CodeableConcept
9476    case -1868521062:
9477      /* subType */ return this.subType == null ? new Base[0] : new Base[] { this.subType }; // CodeableConcept
9478    case 116103:
9479      /* use */ return this.use == null ? new Base[0] : new Base[] { this.use }; // Enumeration<Use>
9480    case -791418107:
9481      /* patient */ return this.patient == null ? new Base[0] : new Base[] { this.patient }; // Reference
9482    case 1028554472:
9483      /* created */ return this.created == null ? new Base[0] : new Base[] { this.created }; // DateTimeType
9484    case 1957615864:
9485      /* insurer */ return this.insurer == null ? new Base[0] : new Base[] { this.insurer }; // Reference
9486    case 693934258:
9487      /* requestor */ return this.requestor == null ? new Base[0] : new Base[] { this.requestor }; // Reference
9488    case 1095692943:
9489      /* request */ return this.request == null ? new Base[0] : new Base[] { this.request }; // Reference
9490    case -1106507950:
9491      /* outcome */ return this.outcome == null ? new Base[0] : new Base[] { this.outcome }; // Enumeration<RemittanceOutcome>
9492    case 583380919:
9493      /* disposition */ return this.disposition == null ? new Base[0] : new Base[] { this.disposition }; // StringType
9494    case 522246568:
9495      /* preAuthRef */ return this.preAuthRef == null ? new Base[0] : new Base[] { this.preAuthRef }; // StringType
9496    case 1819164812:
9497      /* preAuthPeriod */ return this.preAuthPeriod == null ? new Base[0] : new Base[] { this.preAuthPeriod }; // Period
9498    case -316321118:
9499      /* payeeType */ return this.payeeType == null ? new Base[0] : new Base[] { this.payeeType }; // CodeableConcept
9500    case 3242771:
9501      /* item */ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
9502    case -1148899500:
9503      /* addItem */ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
9504    case -231349275:
9505      /* adjudication */ return this.adjudication == null ? new Base[0]
9506          : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
9507    case 110549828:
9508      /* total */ return this.total == null ? new Base[0] : this.total.toArray(new Base[this.total.size()]); // TotalComponent
9509    case -786681338:
9510      /* payment */ return this.payment == null ? new Base[0] : new Base[] { this.payment }; // PaymentComponent
9511    case 1314609806:
9512      /* fundsReserve */ return this.fundsReserve == null ? new Base[0] : new Base[] { this.fundsReserve }; // CodeableConcept
9513    case 473181393:
9514      /* formCode */ return this.formCode == null ? new Base[0] : new Base[] { this.formCode }; // CodeableConcept
9515    case 3148996:
9516      /* form */ return this.form == null ? new Base[0] : new Base[] { this.form }; // Attachment
9517    case 202339073:
9518      /* processNote */ return this.processNote == null ? new Base[0]
9519          : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
9520    case -2071896615:
9521      /* communicationRequest */ return this.communicationRequest == null ? new Base[0]
9522          : this.communicationRequest.toArray(new Base[this.communicationRequest.size()]); // Reference
9523    case 73049818:
9524      /* insurance */ return this.insurance == null ? new Base[0]
9525          : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
9526    case 96784904:
9527      /* error */ return this.error == null ? new Base[0] : this.error.toArray(new Base[this.error.size()]); // ErrorComponent
9528    default:
9529      return super.getProperty(hash, name, checkValid);
9530    }
9531
9532  }
9533
9534  @Override
9535  public Base setProperty(int hash, String name, Base value) throws FHIRException {
9536    switch (hash) {
9537    case -1618432855: // identifier
9538      this.getIdentifier().add(castToIdentifier(value)); // Identifier
9539      return value;
9540    case -892481550: // status
9541      value = new ClaimResponseStatusEnumFactory().fromType(castToCode(value));
9542      this.status = (Enumeration) value; // Enumeration<ClaimResponseStatus>
9543      return value;
9544    case 3575610: // type
9545      this.type = castToCodeableConcept(value); // CodeableConcept
9546      return value;
9547    case -1868521062: // subType
9548      this.subType = castToCodeableConcept(value); // CodeableConcept
9549      return value;
9550    case 116103: // use
9551      value = new UseEnumFactory().fromType(castToCode(value));
9552      this.use = (Enumeration) value; // Enumeration<Use>
9553      return value;
9554    case -791418107: // patient
9555      this.patient = castToReference(value); // Reference
9556      return value;
9557    case 1028554472: // created
9558      this.created = castToDateTime(value); // DateTimeType
9559      return value;
9560    case 1957615864: // insurer
9561      this.insurer = castToReference(value); // Reference
9562      return value;
9563    case 693934258: // requestor
9564      this.requestor = castToReference(value); // Reference
9565      return value;
9566    case 1095692943: // request
9567      this.request = castToReference(value); // Reference
9568      return value;
9569    case -1106507950: // outcome
9570      value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
9571      this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
9572      return value;
9573    case 583380919: // disposition
9574      this.disposition = castToString(value); // StringType
9575      return value;
9576    case 522246568: // preAuthRef
9577      this.preAuthRef = castToString(value); // StringType
9578      return value;
9579    case 1819164812: // preAuthPeriod
9580      this.preAuthPeriod = castToPeriod(value); // Period
9581      return value;
9582    case -316321118: // payeeType
9583      this.payeeType = castToCodeableConcept(value); // CodeableConcept
9584      return value;
9585    case 3242771: // item
9586      this.getItem().add((ItemComponent) value); // ItemComponent
9587      return value;
9588    case -1148899500: // addItem
9589      this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
9590      return value;
9591    case -231349275: // adjudication
9592      this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
9593      return value;
9594    case 110549828: // total
9595      this.getTotal().add((TotalComponent) value); // TotalComponent
9596      return value;
9597    case -786681338: // payment
9598      this.payment = (PaymentComponent) value; // PaymentComponent
9599      return value;
9600    case 1314609806: // fundsReserve
9601      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
9602      return value;
9603    case 473181393: // formCode
9604      this.formCode = castToCodeableConcept(value); // CodeableConcept
9605      return value;
9606    case 3148996: // form
9607      this.form = castToAttachment(value); // Attachment
9608      return value;
9609    case 202339073: // processNote
9610      this.getProcessNote().add((NoteComponent) value); // NoteComponent
9611      return value;
9612    case -2071896615: // communicationRequest
9613      this.getCommunicationRequest().add(castToReference(value)); // Reference
9614      return value;
9615    case 73049818: // insurance
9616      this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
9617      return value;
9618    case 96784904: // error
9619      this.getError().add((ErrorComponent) value); // ErrorComponent
9620      return value;
9621    default:
9622      return super.setProperty(hash, name, value);
9623    }
9624
9625  }
9626
9627  @Override
9628  public Base setProperty(String name, Base value) throws FHIRException {
9629    if (name.equals("identifier")) {
9630      this.getIdentifier().add(castToIdentifier(value));
9631    } else if (name.equals("status")) {
9632      value = new ClaimResponseStatusEnumFactory().fromType(castToCode(value));
9633      this.status = (Enumeration) value; // Enumeration<ClaimResponseStatus>
9634    } else if (name.equals("type")) {
9635      this.type = castToCodeableConcept(value); // CodeableConcept
9636    } else if (name.equals("subType")) {
9637      this.subType = castToCodeableConcept(value); // CodeableConcept
9638    } else if (name.equals("use")) {
9639      value = new UseEnumFactory().fromType(castToCode(value));
9640      this.use = (Enumeration) value; // Enumeration<Use>
9641    } else if (name.equals("patient")) {
9642      this.patient = castToReference(value); // Reference
9643    } else if (name.equals("created")) {
9644      this.created = castToDateTime(value); // DateTimeType
9645    } else if (name.equals("insurer")) {
9646      this.insurer = castToReference(value); // Reference
9647    } else if (name.equals("requestor")) {
9648      this.requestor = castToReference(value); // Reference
9649    } else if (name.equals("request")) {
9650      this.request = castToReference(value); // Reference
9651    } else if (name.equals("outcome")) {
9652      value = new RemittanceOutcomeEnumFactory().fromType(castToCode(value));
9653      this.outcome = (Enumeration) value; // Enumeration<RemittanceOutcome>
9654    } else if (name.equals("disposition")) {
9655      this.disposition = castToString(value); // StringType
9656    } else if (name.equals("preAuthRef")) {
9657      this.preAuthRef = castToString(value); // StringType
9658    } else if (name.equals("preAuthPeriod")) {
9659      this.preAuthPeriod = castToPeriod(value); // Period
9660    } else if (name.equals("payeeType")) {
9661      this.payeeType = castToCodeableConcept(value); // CodeableConcept
9662    } else if (name.equals("item")) {
9663      this.getItem().add((ItemComponent) value);
9664    } else if (name.equals("addItem")) {
9665      this.getAddItem().add((AddedItemComponent) value);
9666    } else if (name.equals("adjudication")) {
9667      this.getAdjudication().add((AdjudicationComponent) value);
9668    } else if (name.equals("total")) {
9669      this.getTotal().add((TotalComponent) value);
9670    } else if (name.equals("payment")) {
9671      this.payment = (PaymentComponent) value; // PaymentComponent
9672    } else if (name.equals("fundsReserve")) {
9673      this.fundsReserve = castToCodeableConcept(value); // CodeableConcept
9674    } else if (name.equals("formCode")) {
9675      this.formCode = castToCodeableConcept(value); // CodeableConcept
9676    } else if (name.equals("form")) {
9677      this.form = castToAttachment(value); // Attachment
9678    } else if (name.equals("processNote")) {
9679      this.getProcessNote().add((NoteComponent) value);
9680    } else if (name.equals("communicationRequest")) {
9681      this.getCommunicationRequest().add(castToReference(value));
9682    } else if (name.equals("insurance")) {
9683      this.getInsurance().add((InsuranceComponent) value);
9684    } else if (name.equals("error")) {
9685      this.getError().add((ErrorComponent) value);
9686    } else
9687      return super.setProperty(name, value);
9688    return value;
9689  }
9690
9691  @Override
9692  public Base makeProperty(int hash, String name) throws FHIRException {
9693    switch (hash) {
9694    case -1618432855:
9695      return addIdentifier();
9696    case -892481550:
9697      return getStatusElement();
9698    case 3575610:
9699      return getType();
9700    case -1868521062:
9701      return getSubType();
9702    case 116103:
9703      return getUseElement();
9704    case -791418107:
9705      return getPatient();
9706    case 1028554472:
9707      return getCreatedElement();
9708    case 1957615864:
9709      return getInsurer();
9710    case 693934258:
9711      return getRequestor();
9712    case 1095692943:
9713      return getRequest();
9714    case -1106507950:
9715      return getOutcomeElement();
9716    case 583380919:
9717      return getDispositionElement();
9718    case 522246568:
9719      return getPreAuthRefElement();
9720    case 1819164812:
9721      return getPreAuthPeriod();
9722    case -316321118:
9723      return getPayeeType();
9724    case 3242771:
9725      return addItem();
9726    case -1148899500:
9727      return addAddItem();
9728    case -231349275:
9729      return addAdjudication();
9730    case 110549828:
9731      return addTotal();
9732    case -786681338:
9733      return getPayment();
9734    case 1314609806:
9735      return getFundsReserve();
9736    case 473181393:
9737      return getFormCode();
9738    case 3148996:
9739      return getForm();
9740    case 202339073:
9741      return addProcessNote();
9742    case -2071896615:
9743      return addCommunicationRequest();
9744    case 73049818:
9745      return addInsurance();
9746    case 96784904:
9747      return addError();
9748    default:
9749      return super.makeProperty(hash, name);
9750    }
9751
9752  }
9753
9754  @Override
9755  public String[] getTypesForProperty(int hash, String name) throws FHIRException {
9756    switch (hash) {
9757    case -1618432855:
9758      /* identif