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