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