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