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