001package org.hl7.fhir.dstu3.model;
002
003/*
004  Copyright (c) 2011+, HL7, Inc.
005  All rights reserved.
006  
007  Redistribution and use in source and binary forms, with or without modification, 
008  are permitted provided that the following conditions are met:
009  
010   * Redistributions of source code must retain the above copyright notice, this 
011     list of conditions and the following disclaimer.
012   * Redistributions in binary form must reproduce the above copyright notice, 
013     this list of conditions and the following disclaimer in the documentation 
014     and/or other materials provided with the distribution.
015   * Neither the name of HL7 nor the names of its contributors may be used to 
016     endorse or promote products derived from this software without specific 
017     prior written permission.
018  
019  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
020  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
021  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
022  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
023  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
024  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
025  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
026  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
027  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
028  POSSIBILITY OF SUCH DAMAGE.
029  
030*/
031
032// Generated on Mon, Apr 17, 2017 17:38-0400 for FHIR v3.0.1
033
034import java.util.*;
035
036import java.math.*;
037import org.hl7.fhir.utilities.Utilities;
038import org.hl7.fhir.dstu3.model.Enumerations.*;
039import ca.uhn.fhir.model.api.annotation.ResourceDef;
040import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
041import ca.uhn.fhir.model.api.annotation.Child;
042import ca.uhn.fhir.model.api.annotation.ChildOrder;
043import ca.uhn.fhir.model.api.annotation.Description;
044import ca.uhn.fhir.model.api.annotation.Block;
045import org.hl7.fhir.instance.model.api.*;
046import org.hl7.fhir.exceptions.FHIRException;
047/**
048 * This resource provides the adjudication details from the processing of a Claim resource.
049 */
050@ResourceDef(name="ClaimResponse", profile="http://hl7.org/fhir/Profile/ClaimResponse")
051public class ClaimResponse extends DomainResource {
052
053    public enum ClaimResponseStatus {
054        /**
055         * The instance is currently in-force.
056         */
057        ACTIVE, 
058        /**
059         * The instance is withdrawn, rescinded or reversed.
060         */
061        CANCELLED, 
062        /**
063         * A new instance the contents of which is not complete.
064         */
065        DRAFT, 
066        /**
067         * The instance was entered in error.
068         */
069        ENTEREDINERROR, 
070        /**
071         * added to help the parsers with the generic types
072         */
073        NULL;
074        public static ClaimResponseStatus fromCode(String codeString) throws FHIRException {
075            if (codeString == null || "".equals(codeString))
076                return null;
077        if ("active".equals(codeString))
078          return ACTIVE;
079        if ("cancelled".equals(codeString))
080          return CANCELLED;
081        if ("draft".equals(codeString))
082          return DRAFT;
083        if ("entered-in-error".equals(codeString))
084          return ENTEREDINERROR;
085        if (Configuration.isAcceptInvalidEnums())
086          return null;
087        else
088          throw new FHIRException("Unknown ClaimResponseStatus code '"+codeString+"'");
089        }
090        public String toCode() {
091          switch (this) {
092            case ACTIVE: return "active";
093            case CANCELLED: return "cancelled";
094            case DRAFT: return "draft";
095            case ENTEREDINERROR: return "entered-in-error";
096            default: return "?";
097          }
098        }
099        public String getSystem() {
100          switch (this) {
101            case ACTIVE: return "http://hl7.org/fhir/fm-status";
102            case CANCELLED: return "http://hl7.org/fhir/fm-status";
103            case DRAFT: return "http://hl7.org/fhir/fm-status";
104            case ENTEREDINERROR: return "http://hl7.org/fhir/fm-status";
105            default: return "?";
106          }
107        }
108        public String getDefinition() {
109          switch (this) {
110            case ACTIVE: return "The instance is currently in-force.";
111            case CANCELLED: return "The instance is withdrawn, rescinded or reversed.";
112            case DRAFT: return "A new instance the contents of which is not complete.";
113            case ENTEREDINERROR: return "The instance was entered in error.";
114            default: return "?";
115          }
116        }
117        public String getDisplay() {
118          switch (this) {
119            case ACTIVE: return "Active";
120            case CANCELLED: return "Cancelled";
121            case DRAFT: return "Draft";
122            case ENTEREDINERROR: return "Entered in Error";
123            default: return "?";
124          }
125        }
126    }
127
128  public static class ClaimResponseStatusEnumFactory implements EnumFactory<ClaimResponseStatus> {
129    public ClaimResponseStatus fromCode(String codeString) throws IllegalArgumentException {
130      if (codeString == null || "".equals(codeString))
131            if (codeString == null || "".equals(codeString))
132                return null;
133        if ("active".equals(codeString))
134          return ClaimResponseStatus.ACTIVE;
135        if ("cancelled".equals(codeString))
136          return ClaimResponseStatus.CANCELLED;
137        if ("draft".equals(codeString))
138          return ClaimResponseStatus.DRAFT;
139        if ("entered-in-error".equals(codeString))
140          return ClaimResponseStatus.ENTEREDINERROR;
141        throw new IllegalArgumentException("Unknown ClaimResponseStatus code '"+codeString+"'");
142        }
143        public Enumeration<ClaimResponseStatus> fromType(Base code) throws FHIRException {
144          if (code == null)
145            return null;
146          if (code.isEmpty())
147            return new Enumeration<ClaimResponseStatus>(this);
148          String codeString = ((PrimitiveType) code).asStringValue();
149          if (codeString == null || "".equals(codeString))
150            return null;
151        if ("active".equals(codeString))
152          return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.ACTIVE);
153        if ("cancelled".equals(codeString))
154          return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.CANCELLED);
155        if ("draft".equals(codeString))
156          return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.DRAFT);
157        if ("entered-in-error".equals(codeString))
158          return new Enumeration<ClaimResponseStatus>(this, ClaimResponseStatus.ENTEREDINERROR);
159        throw new FHIRException("Unknown ClaimResponseStatus code '"+codeString+"'");
160        }
161    public String toCode(ClaimResponseStatus code) {
162      if (code == ClaimResponseStatus.ACTIVE)
163        return "active";
164      if (code == ClaimResponseStatus.CANCELLED)
165        return "cancelled";
166      if (code == ClaimResponseStatus.DRAFT)
167        return "draft";
168      if (code == ClaimResponseStatus.ENTEREDINERROR)
169        return "entered-in-error";
170      return "?";
171      }
172    public String toSystem(ClaimResponseStatus code) {
173      return code.getSystem();
174      }
175    }
176
177    @Block()
178    public static class ItemComponent extends BackboneElement implements IBaseBackboneElement {
179        /**
180         * A service line number.
181         */
182        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
183        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
184        protected PositiveIntType sequenceLinkId;
185
186        /**
187         * A list of note references to the notes provided below.
188         */
189        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
190        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
191        protected List<PositiveIntType> noteNumber;
192
193        /**
194         * The adjudication results.
195         */
196        @Child(name = "adjudication", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
197        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudication results." )
198        protected List<AdjudicationComponent> adjudication;
199
200        /**
201         * The second tier service adjudications for submitted services.
202         */
203        @Child(name = "detail", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
204        @Description(shortDefinition="Detail line items", formalDefinition="The second tier service adjudications for submitted services." )
205        protected List<ItemDetailComponent> detail;
206
207        private static final long serialVersionUID = -1282041398L;
208
209    /**
210     * Constructor
211     */
212      public ItemComponent() {
213        super();
214      }
215
216    /**
217     * Constructor
218     */
219      public ItemComponent(PositiveIntType sequenceLinkId) {
220        super();
221        this.sequenceLinkId = sequenceLinkId;
222      }
223
224        /**
225         * @return {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
226         */
227        public PositiveIntType getSequenceLinkIdElement() { 
228          if (this.sequenceLinkId == null)
229            if (Configuration.errorOnAutoCreate())
230              throw new Error("Attempt to auto-create ItemComponent.sequenceLinkId");
231            else if (Configuration.doAutoCreate())
232              this.sequenceLinkId = new PositiveIntType(); // bb
233          return this.sequenceLinkId;
234        }
235
236        public boolean hasSequenceLinkIdElement() { 
237          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
238        }
239
240        public boolean hasSequenceLinkId() { 
241          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
242        }
243
244        /**
245         * @param value {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
246         */
247        public ItemComponent setSequenceLinkIdElement(PositiveIntType value) { 
248          this.sequenceLinkId = value;
249          return this;
250        }
251
252        /**
253         * @return A service line number.
254         */
255        public int getSequenceLinkId() { 
256          return this.sequenceLinkId == null || this.sequenceLinkId.isEmpty() ? 0 : this.sequenceLinkId.getValue();
257        }
258
259        /**
260         * @param value A service line number.
261         */
262        public ItemComponent setSequenceLinkId(int value) { 
263            if (this.sequenceLinkId == null)
264              this.sequenceLinkId = new PositiveIntType();
265            this.sequenceLinkId.setValue(value);
266          return this;
267        }
268
269        /**
270         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
271         */
272        public List<PositiveIntType> getNoteNumber() { 
273          if (this.noteNumber == null)
274            this.noteNumber = new ArrayList<PositiveIntType>();
275          return this.noteNumber;
276        }
277
278        /**
279         * @return Returns a reference to <code>this</code> for easy method chaining
280         */
281        public ItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
282          this.noteNumber = theNoteNumber;
283          return this;
284        }
285
286        public boolean hasNoteNumber() { 
287          if (this.noteNumber == null)
288            return false;
289          for (PositiveIntType item : this.noteNumber)
290            if (!item.isEmpty())
291              return true;
292          return false;
293        }
294
295        /**
296         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
297         */
298        public PositiveIntType addNoteNumberElement() {//2 
299          PositiveIntType t = new PositiveIntType();
300          if (this.noteNumber == null)
301            this.noteNumber = new ArrayList<PositiveIntType>();
302          this.noteNumber.add(t);
303          return t;
304        }
305
306        /**
307         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
308         */
309        public ItemComponent addNoteNumber(int value) { //1
310          PositiveIntType t = new PositiveIntType();
311          t.setValue(value);
312          if (this.noteNumber == null)
313            this.noteNumber = new ArrayList<PositiveIntType>();
314          this.noteNumber.add(t);
315          return this;
316        }
317
318        /**
319         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
320         */
321        public boolean hasNoteNumber(int value) { 
322          if (this.noteNumber == null)
323            return false;
324          for (PositiveIntType v : this.noteNumber)
325            if (v.equals(value)) // positiveInt
326              return true;
327          return false;
328        }
329
330        /**
331         * @return {@link #adjudication} (The adjudication results.)
332         */
333        public List<AdjudicationComponent> getAdjudication() { 
334          if (this.adjudication == null)
335            this.adjudication = new ArrayList<AdjudicationComponent>();
336          return this.adjudication;
337        }
338
339        /**
340         * @return Returns a reference to <code>this</code> for easy method chaining
341         */
342        public ItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
343          this.adjudication = theAdjudication;
344          return this;
345        }
346
347        public boolean hasAdjudication() { 
348          if (this.adjudication == null)
349            return false;
350          for (AdjudicationComponent item : this.adjudication)
351            if (!item.isEmpty())
352              return true;
353          return false;
354        }
355
356        public AdjudicationComponent addAdjudication() { //3
357          AdjudicationComponent t = new AdjudicationComponent();
358          if (this.adjudication == null)
359            this.adjudication = new ArrayList<AdjudicationComponent>();
360          this.adjudication.add(t);
361          return t;
362        }
363
364        public ItemComponent addAdjudication(AdjudicationComponent t) { //3
365          if (t == null)
366            return this;
367          if (this.adjudication == null)
368            this.adjudication = new ArrayList<AdjudicationComponent>();
369          this.adjudication.add(t);
370          return this;
371        }
372
373        /**
374         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
375         */
376        public AdjudicationComponent getAdjudicationFirstRep() { 
377          if (getAdjudication().isEmpty()) {
378            addAdjudication();
379          }
380          return getAdjudication().get(0);
381        }
382
383        /**
384         * @return {@link #detail} (The second tier service adjudications for submitted services.)
385         */
386        public List<ItemDetailComponent> getDetail() { 
387          if (this.detail == null)
388            this.detail = new ArrayList<ItemDetailComponent>();
389          return this.detail;
390        }
391
392        /**
393         * @return Returns a reference to <code>this</code> for easy method chaining
394         */
395        public ItemComponent setDetail(List<ItemDetailComponent> theDetail) { 
396          this.detail = theDetail;
397          return this;
398        }
399
400        public boolean hasDetail() { 
401          if (this.detail == null)
402            return false;
403          for (ItemDetailComponent item : this.detail)
404            if (!item.isEmpty())
405              return true;
406          return false;
407        }
408
409        public ItemDetailComponent addDetail() { //3
410          ItemDetailComponent t = new ItemDetailComponent();
411          if (this.detail == null)
412            this.detail = new ArrayList<ItemDetailComponent>();
413          this.detail.add(t);
414          return t;
415        }
416
417        public ItemComponent addDetail(ItemDetailComponent t) { //3
418          if (t == null)
419            return this;
420          if (this.detail == null)
421            this.detail = new ArrayList<ItemDetailComponent>();
422          this.detail.add(t);
423          return this;
424        }
425
426        /**
427         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
428         */
429        public ItemDetailComponent getDetailFirstRep() { 
430          if (getDetail().isEmpty()) {
431            addDetail();
432          }
433          return getDetail().get(0);
434        }
435
436        protected void listChildren(List<Property> childrenList) {
437          super.listChildren(childrenList);
438          childrenList.add(new Property("sequenceLinkId", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
439          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
440          childrenList.add(new Property("adjudication", "", "The adjudication results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
441          childrenList.add(new Property("detail", "", "The second tier service adjudications for submitted services.", 0, java.lang.Integer.MAX_VALUE, detail));
442        }
443
444      @Override
445      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
446        switch (hash) {
447        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : new Base[] {this.sequenceLinkId}; // PositiveIntType
448        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
449        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
450        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // ItemDetailComponent
451        default: return super.getProperty(hash, name, checkValid);
452        }
453
454      }
455
456      @Override
457      public Base setProperty(int hash, String name, Base value) throws FHIRException {
458        switch (hash) {
459        case -1422298666: // sequenceLinkId
460          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
461          return value;
462        case -1110033957: // noteNumber
463          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
464          return value;
465        case -231349275: // adjudication
466          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
467          return value;
468        case -1335224239: // detail
469          this.getDetail().add((ItemDetailComponent) value); // ItemDetailComponent
470          return value;
471        default: return super.setProperty(hash, name, value);
472        }
473
474      }
475
476      @Override
477      public Base setProperty(String name, Base value) throws FHIRException {
478        if (name.equals("sequenceLinkId")) {
479          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
480        } else if (name.equals("noteNumber")) {
481          this.getNoteNumber().add(castToPositiveInt(value));
482        } else if (name.equals("adjudication")) {
483          this.getAdjudication().add((AdjudicationComponent) value);
484        } else if (name.equals("detail")) {
485          this.getDetail().add((ItemDetailComponent) value);
486        } else
487          return super.setProperty(name, value);
488        return value;
489      }
490
491      @Override
492      public Base makeProperty(int hash, String name) throws FHIRException {
493        switch (hash) {
494        case -1422298666:  return getSequenceLinkIdElement();
495        case -1110033957:  return addNoteNumberElement();
496        case -231349275:  return addAdjudication(); 
497        case -1335224239:  return addDetail(); 
498        default: return super.makeProperty(hash, name);
499        }
500
501      }
502
503      @Override
504      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
505        switch (hash) {
506        case -1422298666: /*sequenceLinkId*/ return new String[] {"positiveInt"};
507        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
508        case -231349275: /*adjudication*/ return new String[] {};
509        case -1335224239: /*detail*/ return new String[] {};
510        default: return super.getTypesForProperty(hash, name);
511        }
512
513      }
514
515      @Override
516      public Base addChild(String name) throws FHIRException {
517        if (name.equals("sequenceLinkId")) {
518          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
519        }
520        else if (name.equals("noteNumber")) {
521          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.noteNumber");
522        }
523        else if (name.equals("adjudication")) {
524          return addAdjudication();
525        }
526        else if (name.equals("detail")) {
527          return addDetail();
528        }
529        else
530          return super.addChild(name);
531      }
532
533      public ItemComponent copy() {
534        ItemComponent dst = new ItemComponent();
535        copyValues(dst);
536        dst.sequenceLinkId = sequenceLinkId == null ? null : sequenceLinkId.copy();
537        if (noteNumber != null) {
538          dst.noteNumber = new ArrayList<PositiveIntType>();
539          for (PositiveIntType i : noteNumber)
540            dst.noteNumber.add(i.copy());
541        };
542        if (adjudication != null) {
543          dst.adjudication = new ArrayList<AdjudicationComponent>();
544          for (AdjudicationComponent i : adjudication)
545            dst.adjudication.add(i.copy());
546        };
547        if (detail != null) {
548          dst.detail = new ArrayList<ItemDetailComponent>();
549          for (ItemDetailComponent i : detail)
550            dst.detail.add(i.copy());
551        };
552        return dst;
553      }
554
555      @Override
556      public boolean equalsDeep(Base other) {
557        if (!super.equalsDeep(other))
558          return false;
559        if (!(other instanceof ItemComponent))
560          return false;
561        ItemComponent o = (ItemComponent) other;
562        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(noteNumber, o.noteNumber, true)
563           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
564      }
565
566      @Override
567      public boolean equalsShallow(Base other) {
568        if (!super.equalsShallow(other))
569          return false;
570        if (!(other instanceof ItemComponent))
571          return false;
572        ItemComponent o = (ItemComponent) other;
573        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumber, o.noteNumber, true)
574          ;
575      }
576
577      public boolean isEmpty() {
578        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceLinkId, noteNumber
579          , adjudication, detail);
580      }
581
582  public String fhirType() {
583    return "ClaimResponse.item";
584
585  }
586
587  }
588
589    @Block()
590    public static class AdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
591        /**
592         * Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.
593         */
594        @Child(name = "category", type = {CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false)
595        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc." )
596        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication")
597        protected CodeableConcept category;
598
599        /**
600         * Adjudication reason such as limit reached.
601         */
602        @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
603        @Description(shortDefinition="Explanation of Adjudication outcome", formalDefinition="Adjudication reason such as limit reached." )
604        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-reason")
605        protected CodeableConcept reason;
606
607        /**
608         * Monetary amount associated with the code.
609         */
610        @Child(name = "amount", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=false)
611        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the code." )
612        protected Money amount;
613
614        /**
615         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
616         */
617        @Child(name = "value", type = {DecimalType.class}, order=4, min=0, max=1, modifier=false, summary=false)
618        @Description(shortDefinition="Non-monetary value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
619        protected DecimalType value;
620
621        private static final long serialVersionUID = 1559898786L;
622
623    /**
624     * Constructor
625     */
626      public AdjudicationComponent() {
627        super();
628      }
629
630    /**
631     * Constructor
632     */
633      public AdjudicationComponent(CodeableConcept category) {
634        super();
635        this.category = category;
636      }
637
638        /**
639         * @return {@link #category} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
640         */
641        public CodeableConcept getCategory() { 
642          if (this.category == null)
643            if (Configuration.errorOnAutoCreate())
644              throw new Error("Attempt to auto-create AdjudicationComponent.category");
645            else if (Configuration.doAutoCreate())
646              this.category = new CodeableConcept(); // cc
647          return this.category;
648        }
649
650        public boolean hasCategory() { 
651          return this.category != null && !this.category.isEmpty();
652        }
653
654        /**
655         * @param value {@link #category} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
656         */
657        public AdjudicationComponent setCategory(CodeableConcept value) { 
658          this.category = value;
659          return this;
660        }
661
662        /**
663         * @return {@link #reason} (Adjudication reason such as limit reached.)
664         */
665        public CodeableConcept getReason() { 
666          if (this.reason == null)
667            if (Configuration.errorOnAutoCreate())
668              throw new Error("Attempt to auto-create AdjudicationComponent.reason");
669            else if (Configuration.doAutoCreate())
670              this.reason = new CodeableConcept(); // cc
671          return this.reason;
672        }
673
674        public boolean hasReason() { 
675          return this.reason != null && !this.reason.isEmpty();
676        }
677
678        /**
679         * @param value {@link #reason} (Adjudication reason such as limit reached.)
680         */
681        public AdjudicationComponent setReason(CodeableConcept value) { 
682          this.reason = value;
683          return this;
684        }
685
686        /**
687         * @return {@link #amount} (Monetary amount associated with the code.)
688         */
689        public Money getAmount() { 
690          if (this.amount == null)
691            if (Configuration.errorOnAutoCreate())
692              throw new Error("Attempt to auto-create AdjudicationComponent.amount");
693            else if (Configuration.doAutoCreate())
694              this.amount = new Money(); // cc
695          return this.amount;
696        }
697
698        public boolean hasAmount() { 
699          return this.amount != null && !this.amount.isEmpty();
700        }
701
702        /**
703         * @param value {@link #amount} (Monetary amount associated with the code.)
704         */
705        public AdjudicationComponent setAmount(Money value) { 
706          this.amount = value;
707          return this;
708        }
709
710        /**
711         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
712         */
713        public DecimalType getValueElement() { 
714          if (this.value == null)
715            if (Configuration.errorOnAutoCreate())
716              throw new Error("Attempt to auto-create AdjudicationComponent.value");
717            else if (Configuration.doAutoCreate())
718              this.value = new DecimalType(); // bb
719          return this.value;
720        }
721
722        public boolean hasValueElement() { 
723          return this.value != null && !this.value.isEmpty();
724        }
725
726        public boolean hasValue() { 
727          return this.value != null && !this.value.isEmpty();
728        }
729
730        /**
731         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
732         */
733        public AdjudicationComponent setValueElement(DecimalType value) { 
734          this.value = value;
735          return this;
736        }
737
738        /**
739         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
740         */
741        public BigDecimal getValue() { 
742          return this.value == null ? null : this.value.getValue();
743        }
744
745        /**
746         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
747         */
748        public AdjudicationComponent setValue(BigDecimal value) { 
749          if (value == null)
750            this.value = null;
751          else {
752            if (this.value == null)
753              this.value = new DecimalType();
754            this.value.setValue(value);
755          }
756          return this;
757        }
758
759        /**
760         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
761         */
762        public AdjudicationComponent setValue(long value) { 
763              this.value = new DecimalType();
764            this.value.setValue(value);
765          return this;
766        }
767
768        /**
769         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
770         */
771        public AdjudicationComponent setValue(double value) { 
772              this.value = new DecimalType();
773            this.value.setValue(value);
774          return this;
775        }
776
777        protected void listChildren(List<Property> childrenList) {
778          super.listChildren(childrenList);
779          childrenList.add(new Property("category", "CodeableConcept", "Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, category));
780          childrenList.add(new Property("reason", "CodeableConcept", "Adjudication reason such as limit reached.", 0, java.lang.Integer.MAX_VALUE, reason));
781          childrenList.add(new Property("amount", "Money", "Monetary amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
782          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
783        }
784
785      @Override
786      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
787        switch (hash) {
788        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
789        case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept
790        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
791        case 111972721: /*value*/ return this.value == null ? new Base[0] : new Base[] {this.value}; // DecimalType
792        default: return super.getProperty(hash, name, checkValid);
793        }
794
795      }
796
797      @Override
798      public Base setProperty(int hash, String name, Base value) throws FHIRException {
799        switch (hash) {
800        case 50511102: // category
801          this.category = castToCodeableConcept(value); // CodeableConcept
802          return value;
803        case -934964668: // reason
804          this.reason = castToCodeableConcept(value); // CodeableConcept
805          return value;
806        case -1413853096: // amount
807          this.amount = castToMoney(value); // Money
808          return value;
809        case 111972721: // value
810          this.value = castToDecimal(value); // DecimalType
811          return value;
812        default: return super.setProperty(hash, name, value);
813        }
814
815      }
816
817      @Override
818      public Base setProperty(String name, Base value) throws FHIRException {
819        if (name.equals("category")) {
820          this.category = castToCodeableConcept(value); // CodeableConcept
821        } else if (name.equals("reason")) {
822          this.reason = castToCodeableConcept(value); // CodeableConcept
823        } else if (name.equals("amount")) {
824          this.amount = castToMoney(value); // Money
825        } else if (name.equals("value")) {
826          this.value = castToDecimal(value); // DecimalType
827        } else
828          return super.setProperty(name, value);
829        return value;
830      }
831
832      @Override
833      public Base makeProperty(int hash, String name) throws FHIRException {
834        switch (hash) {
835        case 50511102:  return getCategory(); 
836        case -934964668:  return getReason(); 
837        case -1413853096:  return getAmount(); 
838        case 111972721:  return getValueElement();
839        default: return super.makeProperty(hash, name);
840        }
841
842      }
843
844      @Override
845      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
846        switch (hash) {
847        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
848        case -934964668: /*reason*/ return new String[] {"CodeableConcept"};
849        case -1413853096: /*amount*/ return new String[] {"Money"};
850        case 111972721: /*value*/ return new String[] {"decimal"};
851        default: return super.getTypesForProperty(hash, name);
852        }
853
854      }
855
856      @Override
857      public Base addChild(String name) throws FHIRException {
858        if (name.equals("category")) {
859          this.category = new CodeableConcept();
860          return this.category;
861        }
862        else if (name.equals("reason")) {
863          this.reason = new CodeableConcept();
864          return this.reason;
865        }
866        else if (name.equals("amount")) {
867          this.amount = new Money();
868          return this.amount;
869        }
870        else if (name.equals("value")) {
871          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.value");
872        }
873        else
874          return super.addChild(name);
875      }
876
877      public AdjudicationComponent copy() {
878        AdjudicationComponent dst = new AdjudicationComponent();
879        copyValues(dst);
880        dst.category = category == null ? null : category.copy();
881        dst.reason = reason == null ? null : reason.copy();
882        dst.amount = amount == null ? null : amount.copy();
883        dst.value = value == null ? null : value.copy();
884        return dst;
885      }
886
887      @Override
888      public boolean equalsDeep(Base other) {
889        if (!super.equalsDeep(other))
890          return false;
891        if (!(other instanceof AdjudicationComponent))
892          return false;
893        AdjudicationComponent o = (AdjudicationComponent) other;
894        return compareDeep(category, o.category, true) && compareDeep(reason, o.reason, true) && compareDeep(amount, o.amount, true)
895           && compareDeep(value, o.value, true);
896      }
897
898      @Override
899      public boolean equalsShallow(Base other) {
900        if (!super.equalsShallow(other))
901          return false;
902        if (!(other instanceof AdjudicationComponent))
903          return false;
904        AdjudicationComponent o = (AdjudicationComponent) other;
905        return compareValues(value, o.value, true);
906      }
907
908      public boolean isEmpty() {
909        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(category, reason, amount
910          , value);
911      }
912
913  public String fhirType() {
914    return "ClaimResponse.item.adjudication";
915
916  }
917
918  }
919
920    @Block()
921    public static class ItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
922        /**
923         * A service line number.
924         */
925        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
926        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
927        protected PositiveIntType sequenceLinkId;
928
929        /**
930         * A list of note references to the notes provided below.
931         */
932        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
933        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
934        protected List<PositiveIntType> noteNumber;
935
936        /**
937         * The adjudications results.
938         */
939        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
940        @Description(shortDefinition="Detail level adjudication details", formalDefinition="The adjudications results." )
941        protected List<AdjudicationComponent> adjudication;
942
943        /**
944         * The third tier service adjudications for submitted services.
945         */
946        @Child(name = "subDetail", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
947        @Description(shortDefinition="Subdetail line items", formalDefinition="The third tier service adjudications for submitted services." )
948        protected List<SubDetailComponent> subDetail;
949
950        private static final long serialVersionUID = -1245557773L;
951
952    /**
953     * Constructor
954     */
955      public ItemDetailComponent() {
956        super();
957      }
958
959    /**
960     * Constructor
961     */
962      public ItemDetailComponent(PositiveIntType sequenceLinkId) {
963        super();
964        this.sequenceLinkId = sequenceLinkId;
965      }
966
967        /**
968         * @return {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
969         */
970        public PositiveIntType getSequenceLinkIdElement() { 
971          if (this.sequenceLinkId == null)
972            if (Configuration.errorOnAutoCreate())
973              throw new Error("Attempt to auto-create ItemDetailComponent.sequenceLinkId");
974            else if (Configuration.doAutoCreate())
975              this.sequenceLinkId = new PositiveIntType(); // bb
976          return this.sequenceLinkId;
977        }
978
979        public boolean hasSequenceLinkIdElement() { 
980          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
981        }
982
983        public boolean hasSequenceLinkId() { 
984          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
985        }
986
987        /**
988         * @param value {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
989         */
990        public ItemDetailComponent setSequenceLinkIdElement(PositiveIntType value) { 
991          this.sequenceLinkId = value;
992          return this;
993        }
994
995        /**
996         * @return A service line number.
997         */
998        public int getSequenceLinkId() { 
999          return this.sequenceLinkId == null || this.sequenceLinkId.isEmpty() ? 0 : this.sequenceLinkId.getValue();
1000        }
1001
1002        /**
1003         * @param value A service line number.
1004         */
1005        public ItemDetailComponent setSequenceLinkId(int value) { 
1006            if (this.sequenceLinkId == null)
1007              this.sequenceLinkId = new PositiveIntType();
1008            this.sequenceLinkId.setValue(value);
1009          return this;
1010        }
1011
1012        /**
1013         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
1014         */
1015        public List<PositiveIntType> getNoteNumber() { 
1016          if (this.noteNumber == null)
1017            this.noteNumber = new ArrayList<PositiveIntType>();
1018          return this.noteNumber;
1019        }
1020
1021        /**
1022         * @return Returns a reference to <code>this</code> for easy method chaining
1023         */
1024        public ItemDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
1025          this.noteNumber = theNoteNumber;
1026          return this;
1027        }
1028
1029        public boolean hasNoteNumber() { 
1030          if (this.noteNumber == null)
1031            return false;
1032          for (PositiveIntType item : this.noteNumber)
1033            if (!item.isEmpty())
1034              return true;
1035          return false;
1036        }
1037
1038        /**
1039         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
1040         */
1041        public PositiveIntType addNoteNumberElement() {//2 
1042          PositiveIntType t = new PositiveIntType();
1043          if (this.noteNumber == null)
1044            this.noteNumber = new ArrayList<PositiveIntType>();
1045          this.noteNumber.add(t);
1046          return t;
1047        }
1048
1049        /**
1050         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
1051         */
1052        public ItemDetailComponent addNoteNumber(int value) { //1
1053          PositiveIntType t = new PositiveIntType();
1054          t.setValue(value);
1055          if (this.noteNumber == null)
1056            this.noteNumber = new ArrayList<PositiveIntType>();
1057          this.noteNumber.add(t);
1058          return this;
1059        }
1060
1061        /**
1062         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
1063         */
1064        public boolean hasNoteNumber(int value) { 
1065          if (this.noteNumber == null)
1066            return false;
1067          for (PositiveIntType v : this.noteNumber)
1068            if (v.equals(value)) // positiveInt
1069              return true;
1070          return false;
1071        }
1072
1073        /**
1074         * @return {@link #adjudication} (The adjudications results.)
1075         */
1076        public List<AdjudicationComponent> getAdjudication() { 
1077          if (this.adjudication == null)
1078            this.adjudication = new ArrayList<AdjudicationComponent>();
1079          return this.adjudication;
1080        }
1081
1082        /**
1083         * @return Returns a reference to <code>this</code> for easy method chaining
1084         */
1085        public ItemDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
1086          this.adjudication = theAdjudication;
1087          return this;
1088        }
1089
1090        public boolean hasAdjudication() { 
1091          if (this.adjudication == null)
1092            return false;
1093          for (AdjudicationComponent item : this.adjudication)
1094            if (!item.isEmpty())
1095              return true;
1096          return false;
1097        }
1098
1099        public AdjudicationComponent addAdjudication() { //3
1100          AdjudicationComponent t = new AdjudicationComponent();
1101          if (this.adjudication == null)
1102            this.adjudication = new ArrayList<AdjudicationComponent>();
1103          this.adjudication.add(t);
1104          return t;
1105        }
1106
1107        public ItemDetailComponent addAdjudication(AdjudicationComponent t) { //3
1108          if (t == null)
1109            return this;
1110          if (this.adjudication == null)
1111            this.adjudication = new ArrayList<AdjudicationComponent>();
1112          this.adjudication.add(t);
1113          return this;
1114        }
1115
1116        /**
1117         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
1118         */
1119        public AdjudicationComponent getAdjudicationFirstRep() { 
1120          if (getAdjudication().isEmpty()) {
1121            addAdjudication();
1122          }
1123          return getAdjudication().get(0);
1124        }
1125
1126        /**
1127         * @return {@link #subDetail} (The third tier service adjudications for submitted services.)
1128         */
1129        public List<SubDetailComponent> getSubDetail() { 
1130          if (this.subDetail == null)
1131            this.subDetail = new ArrayList<SubDetailComponent>();
1132          return this.subDetail;
1133        }
1134
1135        /**
1136         * @return Returns a reference to <code>this</code> for easy method chaining
1137         */
1138        public ItemDetailComponent setSubDetail(List<SubDetailComponent> theSubDetail) { 
1139          this.subDetail = theSubDetail;
1140          return this;
1141        }
1142
1143        public boolean hasSubDetail() { 
1144          if (this.subDetail == null)
1145            return false;
1146          for (SubDetailComponent item : this.subDetail)
1147            if (!item.isEmpty())
1148              return true;
1149          return false;
1150        }
1151
1152        public SubDetailComponent addSubDetail() { //3
1153          SubDetailComponent t = new SubDetailComponent();
1154          if (this.subDetail == null)
1155            this.subDetail = new ArrayList<SubDetailComponent>();
1156          this.subDetail.add(t);
1157          return t;
1158        }
1159
1160        public ItemDetailComponent addSubDetail(SubDetailComponent t) { //3
1161          if (t == null)
1162            return this;
1163          if (this.subDetail == null)
1164            this.subDetail = new ArrayList<SubDetailComponent>();
1165          this.subDetail.add(t);
1166          return this;
1167        }
1168
1169        /**
1170         * @return The first repetition of repeating field {@link #subDetail}, creating it if it does not already exist
1171         */
1172        public SubDetailComponent getSubDetailFirstRep() { 
1173          if (getSubDetail().isEmpty()) {
1174            addSubDetail();
1175          }
1176          return getSubDetail().get(0);
1177        }
1178
1179        protected void listChildren(List<Property> childrenList) {
1180          super.listChildren(childrenList);
1181          childrenList.add(new Property("sequenceLinkId", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
1182          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
1183          childrenList.add(new Property("adjudication", "@ClaimResponse.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
1184          childrenList.add(new Property("subDetail", "", "The third tier service adjudications for submitted services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
1185        }
1186
1187      @Override
1188      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1189        switch (hash) {
1190        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : new Base[] {this.sequenceLinkId}; // PositiveIntType
1191        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
1192        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
1193        case -828829007: /*subDetail*/ return this.subDetail == null ? new Base[0] : this.subDetail.toArray(new Base[this.subDetail.size()]); // SubDetailComponent
1194        default: return super.getProperty(hash, name, checkValid);
1195        }
1196
1197      }
1198
1199      @Override
1200      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1201        switch (hash) {
1202        case -1422298666: // sequenceLinkId
1203          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
1204          return value;
1205        case -1110033957: // noteNumber
1206          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
1207          return value;
1208        case -231349275: // adjudication
1209          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
1210          return value;
1211        case -828829007: // subDetail
1212          this.getSubDetail().add((SubDetailComponent) value); // SubDetailComponent
1213          return value;
1214        default: return super.setProperty(hash, name, value);
1215        }
1216
1217      }
1218
1219      @Override
1220      public Base setProperty(String name, Base value) throws FHIRException {
1221        if (name.equals("sequenceLinkId")) {
1222          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
1223        } else if (name.equals("noteNumber")) {
1224          this.getNoteNumber().add(castToPositiveInt(value));
1225        } else if (name.equals("adjudication")) {
1226          this.getAdjudication().add((AdjudicationComponent) value);
1227        } else if (name.equals("subDetail")) {
1228          this.getSubDetail().add((SubDetailComponent) value);
1229        } else
1230          return super.setProperty(name, value);
1231        return value;
1232      }
1233
1234      @Override
1235      public Base makeProperty(int hash, String name) throws FHIRException {
1236        switch (hash) {
1237        case -1422298666:  return getSequenceLinkIdElement();
1238        case -1110033957:  return addNoteNumberElement();
1239        case -231349275:  return addAdjudication(); 
1240        case -828829007:  return addSubDetail(); 
1241        default: return super.makeProperty(hash, name);
1242        }
1243
1244      }
1245
1246      @Override
1247      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1248        switch (hash) {
1249        case -1422298666: /*sequenceLinkId*/ return new String[] {"positiveInt"};
1250        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
1251        case -231349275: /*adjudication*/ return new String[] {"@ClaimResponse.item.adjudication"};
1252        case -828829007: /*subDetail*/ return new String[] {};
1253        default: return super.getTypesForProperty(hash, name);
1254        }
1255
1256      }
1257
1258      @Override
1259      public Base addChild(String name) throws FHIRException {
1260        if (name.equals("sequenceLinkId")) {
1261          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
1262        }
1263        else if (name.equals("noteNumber")) {
1264          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.noteNumber");
1265        }
1266        else if (name.equals("adjudication")) {
1267          return addAdjudication();
1268        }
1269        else if (name.equals("subDetail")) {
1270          return addSubDetail();
1271        }
1272        else
1273          return super.addChild(name);
1274      }
1275
1276      public ItemDetailComponent copy() {
1277        ItemDetailComponent dst = new ItemDetailComponent();
1278        copyValues(dst);
1279        dst.sequenceLinkId = sequenceLinkId == null ? null : sequenceLinkId.copy();
1280        if (noteNumber != null) {
1281          dst.noteNumber = new ArrayList<PositiveIntType>();
1282          for (PositiveIntType i : noteNumber)
1283            dst.noteNumber.add(i.copy());
1284        };
1285        if (adjudication != null) {
1286          dst.adjudication = new ArrayList<AdjudicationComponent>();
1287          for (AdjudicationComponent i : adjudication)
1288            dst.adjudication.add(i.copy());
1289        };
1290        if (subDetail != null) {
1291          dst.subDetail = new ArrayList<SubDetailComponent>();
1292          for (SubDetailComponent i : subDetail)
1293            dst.subDetail.add(i.copy());
1294        };
1295        return dst;
1296      }
1297
1298      @Override
1299      public boolean equalsDeep(Base other) {
1300        if (!super.equalsDeep(other))
1301          return false;
1302        if (!(other instanceof ItemDetailComponent))
1303          return false;
1304        ItemDetailComponent o = (ItemDetailComponent) other;
1305        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(noteNumber, o.noteNumber, true)
1306           && compareDeep(adjudication, o.adjudication, true) && compareDeep(subDetail, o.subDetail, true)
1307          ;
1308      }
1309
1310      @Override
1311      public boolean equalsShallow(Base other) {
1312        if (!super.equalsShallow(other))
1313          return false;
1314        if (!(other instanceof ItemDetailComponent))
1315          return false;
1316        ItemDetailComponent o = (ItemDetailComponent) other;
1317        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumber, o.noteNumber, true)
1318          ;
1319      }
1320
1321      public boolean isEmpty() {
1322        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceLinkId, noteNumber
1323          , adjudication, subDetail);
1324      }
1325
1326  public String fhirType() {
1327    return "ClaimResponse.item.detail";
1328
1329  }
1330
1331  }
1332
1333    @Block()
1334    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
1335        /**
1336         * A service line number.
1337         */
1338        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
1339        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
1340        protected PositiveIntType sequenceLinkId;
1341
1342        /**
1343         * A list of note references to the notes provided below.
1344         */
1345        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1346        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
1347        protected List<PositiveIntType> noteNumber;
1348
1349        /**
1350         * The adjudications results.
1351         */
1352        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1353        @Description(shortDefinition="Subdetail level adjudication details", formalDefinition="The adjudications results." )
1354        protected List<AdjudicationComponent> adjudication;
1355
1356        private static final long serialVersionUID = 1770463342L;
1357
1358    /**
1359     * Constructor
1360     */
1361      public SubDetailComponent() {
1362        super();
1363      }
1364
1365    /**
1366     * Constructor
1367     */
1368      public SubDetailComponent(PositiveIntType sequenceLinkId) {
1369        super();
1370        this.sequenceLinkId = sequenceLinkId;
1371      }
1372
1373        /**
1374         * @return {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
1375         */
1376        public PositiveIntType getSequenceLinkIdElement() { 
1377          if (this.sequenceLinkId == null)
1378            if (Configuration.errorOnAutoCreate())
1379              throw new Error("Attempt to auto-create SubDetailComponent.sequenceLinkId");
1380            else if (Configuration.doAutoCreate())
1381              this.sequenceLinkId = new PositiveIntType(); // bb
1382          return this.sequenceLinkId;
1383        }
1384
1385        public boolean hasSequenceLinkIdElement() { 
1386          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
1387        }
1388
1389        public boolean hasSequenceLinkId() { 
1390          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
1391        }
1392
1393        /**
1394         * @param value {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
1395         */
1396        public SubDetailComponent setSequenceLinkIdElement(PositiveIntType value) { 
1397          this.sequenceLinkId = value;
1398          return this;
1399        }
1400
1401        /**
1402         * @return A service line number.
1403         */
1404        public int getSequenceLinkId() { 
1405          return this.sequenceLinkId == null || this.sequenceLinkId.isEmpty() ? 0 : this.sequenceLinkId.getValue();
1406        }
1407
1408        /**
1409         * @param value A service line number.
1410         */
1411        public SubDetailComponent setSequenceLinkId(int value) { 
1412            if (this.sequenceLinkId == null)
1413              this.sequenceLinkId = new PositiveIntType();
1414            this.sequenceLinkId.setValue(value);
1415          return this;
1416        }
1417
1418        /**
1419         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
1420         */
1421        public List<PositiveIntType> getNoteNumber() { 
1422          if (this.noteNumber == null)
1423            this.noteNumber = new ArrayList<PositiveIntType>();
1424          return this.noteNumber;
1425        }
1426
1427        /**
1428         * @return Returns a reference to <code>this</code> for easy method chaining
1429         */
1430        public SubDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
1431          this.noteNumber = theNoteNumber;
1432          return this;
1433        }
1434
1435        public boolean hasNoteNumber() { 
1436          if (this.noteNumber == null)
1437            return false;
1438          for (PositiveIntType item : this.noteNumber)
1439            if (!item.isEmpty())
1440              return true;
1441          return false;
1442        }
1443
1444        /**
1445         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
1446         */
1447        public PositiveIntType addNoteNumberElement() {//2 
1448          PositiveIntType t = new PositiveIntType();
1449          if (this.noteNumber == null)
1450            this.noteNumber = new ArrayList<PositiveIntType>();
1451          this.noteNumber.add(t);
1452          return t;
1453        }
1454
1455        /**
1456         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
1457         */
1458        public SubDetailComponent addNoteNumber(int value) { //1
1459          PositiveIntType t = new PositiveIntType();
1460          t.setValue(value);
1461          if (this.noteNumber == null)
1462            this.noteNumber = new ArrayList<PositiveIntType>();
1463          this.noteNumber.add(t);
1464          return this;
1465        }
1466
1467        /**
1468         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
1469         */
1470        public boolean hasNoteNumber(int value) { 
1471          if (this.noteNumber == null)
1472            return false;
1473          for (PositiveIntType v : this.noteNumber)
1474            if (v.equals(value)) // positiveInt
1475              return true;
1476          return false;
1477        }
1478
1479        /**
1480         * @return {@link #adjudication} (The adjudications results.)
1481         */
1482        public List<AdjudicationComponent> getAdjudication() { 
1483          if (this.adjudication == null)
1484            this.adjudication = new ArrayList<AdjudicationComponent>();
1485          return this.adjudication;
1486        }
1487
1488        /**
1489         * @return Returns a reference to <code>this</code> for easy method chaining
1490         */
1491        public SubDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
1492          this.adjudication = theAdjudication;
1493          return this;
1494        }
1495
1496        public boolean hasAdjudication() { 
1497          if (this.adjudication == null)
1498            return false;
1499          for (AdjudicationComponent item : this.adjudication)
1500            if (!item.isEmpty())
1501              return true;
1502          return false;
1503        }
1504
1505        public AdjudicationComponent addAdjudication() { //3
1506          AdjudicationComponent t = new AdjudicationComponent();
1507          if (this.adjudication == null)
1508            this.adjudication = new ArrayList<AdjudicationComponent>();
1509          this.adjudication.add(t);
1510          return t;
1511        }
1512
1513        public SubDetailComponent addAdjudication(AdjudicationComponent t) { //3
1514          if (t == null)
1515            return this;
1516          if (this.adjudication == null)
1517            this.adjudication = new ArrayList<AdjudicationComponent>();
1518          this.adjudication.add(t);
1519          return this;
1520        }
1521
1522        /**
1523         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
1524         */
1525        public AdjudicationComponent getAdjudicationFirstRep() { 
1526          if (getAdjudication().isEmpty()) {
1527            addAdjudication();
1528          }
1529          return getAdjudication().get(0);
1530        }
1531
1532        protected void listChildren(List<Property> childrenList) {
1533          super.listChildren(childrenList);
1534          childrenList.add(new Property("sequenceLinkId", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
1535          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
1536          childrenList.add(new Property("adjudication", "@ClaimResponse.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
1537        }
1538
1539      @Override
1540      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
1541        switch (hash) {
1542        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : new Base[] {this.sequenceLinkId}; // PositiveIntType
1543        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
1544        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
1545        default: return super.getProperty(hash, name, checkValid);
1546        }
1547
1548      }
1549
1550      @Override
1551      public Base setProperty(int hash, String name, Base value) throws FHIRException {
1552        switch (hash) {
1553        case -1422298666: // sequenceLinkId
1554          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
1555          return value;
1556        case -1110033957: // noteNumber
1557          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
1558          return value;
1559        case -231349275: // adjudication
1560          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
1561          return value;
1562        default: return super.setProperty(hash, name, value);
1563        }
1564
1565      }
1566
1567      @Override
1568      public Base setProperty(String name, Base value) throws FHIRException {
1569        if (name.equals("sequenceLinkId")) {
1570          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
1571        } else if (name.equals("noteNumber")) {
1572          this.getNoteNumber().add(castToPositiveInt(value));
1573        } else if (name.equals("adjudication")) {
1574          this.getAdjudication().add((AdjudicationComponent) value);
1575        } else
1576          return super.setProperty(name, value);
1577        return value;
1578      }
1579
1580      @Override
1581      public Base makeProperty(int hash, String name) throws FHIRException {
1582        switch (hash) {
1583        case -1422298666:  return getSequenceLinkIdElement();
1584        case -1110033957:  return addNoteNumberElement();
1585        case -231349275:  return addAdjudication(); 
1586        default: return super.makeProperty(hash, name);
1587        }
1588
1589      }
1590
1591      @Override
1592      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
1593        switch (hash) {
1594        case -1422298666: /*sequenceLinkId*/ return new String[] {"positiveInt"};
1595        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
1596        case -231349275: /*adjudication*/ return new String[] {"@ClaimResponse.item.adjudication"};
1597        default: return super.getTypesForProperty(hash, name);
1598        }
1599
1600      }
1601
1602      @Override
1603      public Base addChild(String name) throws FHIRException {
1604        if (name.equals("sequenceLinkId")) {
1605          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
1606        }
1607        else if (name.equals("noteNumber")) {
1608          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.noteNumber");
1609        }
1610        else if (name.equals("adjudication")) {
1611          return addAdjudication();
1612        }
1613        else
1614          return super.addChild(name);
1615      }
1616
1617      public SubDetailComponent copy() {
1618        SubDetailComponent dst = new SubDetailComponent();
1619        copyValues(dst);
1620        dst.sequenceLinkId = sequenceLinkId == null ? null : sequenceLinkId.copy();
1621        if (noteNumber != null) {
1622          dst.noteNumber = new ArrayList<PositiveIntType>();
1623          for (PositiveIntType i : noteNumber)
1624            dst.noteNumber.add(i.copy());
1625        };
1626        if (adjudication != null) {
1627          dst.adjudication = new ArrayList<AdjudicationComponent>();
1628          for (AdjudicationComponent i : adjudication)
1629            dst.adjudication.add(i.copy());
1630        };
1631        return dst;
1632      }
1633
1634      @Override
1635      public boolean equalsDeep(Base other) {
1636        if (!super.equalsDeep(other))
1637          return false;
1638        if (!(other instanceof SubDetailComponent))
1639          return false;
1640        SubDetailComponent o = (SubDetailComponent) other;
1641        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(noteNumber, o.noteNumber, true)
1642           && compareDeep(adjudication, o.adjudication, true);
1643      }
1644
1645      @Override
1646      public boolean equalsShallow(Base other) {
1647        if (!super.equalsShallow(other))
1648          return false;
1649        if (!(other instanceof SubDetailComponent))
1650          return false;
1651        SubDetailComponent o = (SubDetailComponent) other;
1652        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumber, o.noteNumber, true)
1653          ;
1654      }
1655
1656      public boolean isEmpty() {
1657        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceLinkId, noteNumber
1658          , adjudication);
1659      }
1660
1661  public String fhirType() {
1662    return "ClaimResponse.item.detail.subDetail";
1663
1664  }
1665
1666  }
1667
1668    @Block()
1669    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
1670        /**
1671         * List of input service items which this service line is intended to replace.
1672         */
1673        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1674        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
1675        protected List<PositiveIntType> sequenceLinkId;
1676
1677        /**
1678         * The type of reveneu or cost center providing the product and/or service.
1679         */
1680        @Child(name = "revenue", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
1681        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
1682        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
1683        protected CodeableConcept revenue;
1684
1685        /**
1686         * Health Care Service Type Codes  to identify the classification of service or benefits.
1687         */
1688        @Child(name = "category", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
1689        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
1690        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
1691        protected CodeableConcept category;
1692
1693        /**
1694         * A code to indicate the Professional Service or Product supplied.
1695         */
1696        @Child(name = "service", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
1697        @Description(shortDefinition="Group, Service or Product", formalDefinition="A code to indicate the Professional Service or Product supplied." )
1698        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
1699        protected CodeableConcept service;
1700
1701        /**
1702         * Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
1703         */
1704        @Child(name = "modifier", type = {CodeableConcept.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1705        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
1706        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
1707        protected List<CodeableConcept> modifier;
1708
1709        /**
1710         * The fee charged for the professional service or product..
1711         */
1712        @Child(name = "fee", type = {Money.class}, order=6, min=0, max=1, modifier=false, summary=false)
1713        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product.." )
1714        protected Money fee;
1715
1716        /**
1717         * A list of note references to the notes provided below.
1718         */
1719        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1720        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
1721        protected List<PositiveIntType> noteNumber;
1722
1723        /**
1724         * The adjudications results.
1725         */
1726        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=8, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1727        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudications results." )
1728        protected List<AdjudicationComponent> adjudication;
1729
1730        /**
1731         * The second tier service adjudications for payor added services.
1732         */
1733        @Child(name = "detail", type = {}, order=9, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
1734        @Description(shortDefinition="Added items details", formalDefinition="The second tier service adjudications for payor added services." )
1735        protected List<AddedItemsDetailComponent> detail;
1736
1737        private static final long serialVersionUID = 1969703165L;
1738
1739    /**
1740     * Constructor
1741     */
1742      public AddedItemComponent() {
1743        super();
1744      }
1745
1746        /**
1747         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
1748         */
1749        public List<PositiveIntType> getSequenceLinkId() { 
1750          if (this.sequenceLinkId == null)
1751            this.sequenceLinkId = new ArrayList<PositiveIntType>();
1752          return this.sequenceLinkId;
1753        }
1754
1755        /**
1756         * @return Returns a reference to <code>this</code> for easy method chaining
1757         */
1758        public AddedItemComponent setSequenceLinkId(List<PositiveIntType> theSequenceLinkId) { 
1759          this.sequenceLinkId = theSequenceLinkId;
1760          return this;
1761        }
1762
1763        public boolean hasSequenceLinkId() { 
1764          if (this.sequenceLinkId == null)
1765            return false;
1766          for (PositiveIntType item : this.sequenceLinkId)
1767            if (!item.isEmpty())
1768              return true;
1769          return false;
1770        }
1771
1772        /**
1773         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
1774         */
1775        public PositiveIntType addSequenceLinkIdElement() {//2 
1776          PositiveIntType t = new PositiveIntType();
1777          if (this.sequenceLinkId == null)
1778            this.sequenceLinkId = new ArrayList<PositiveIntType>();
1779          this.sequenceLinkId.add(t);
1780          return t;
1781        }
1782
1783        /**
1784         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
1785         */
1786        public AddedItemComponent addSequenceLinkId(int value) { //1
1787          PositiveIntType t = new PositiveIntType();
1788          t.setValue(value);
1789          if (this.sequenceLinkId == null)
1790            this.sequenceLinkId = new ArrayList<PositiveIntType>();
1791          this.sequenceLinkId.add(t);
1792          return this;
1793        }
1794
1795        /**
1796         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
1797         */
1798        public boolean hasSequenceLinkId(int value) { 
1799          if (this.sequenceLinkId == null)
1800            return false;
1801          for (PositiveIntType v : this.sequenceLinkId)
1802            if (v.equals(value)) // positiveInt
1803              return true;
1804          return false;
1805        }
1806
1807        /**
1808         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
1809         */
1810        public CodeableConcept getRevenue() { 
1811          if (this.revenue == null)
1812            if (Configuration.errorOnAutoCreate())
1813              throw new Error("Attempt to auto-create AddedItemComponent.revenue");
1814            else if (Configuration.doAutoCreate())
1815              this.revenue = new CodeableConcept(); // cc
1816          return this.revenue;
1817        }
1818
1819        public boolean hasRevenue() { 
1820          return this.revenue != null && !this.revenue.isEmpty();
1821        }
1822
1823        /**
1824         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
1825         */
1826        public AddedItemComponent setRevenue(CodeableConcept value) { 
1827          this.revenue = value;
1828          return this;
1829        }
1830
1831        /**
1832         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
1833         */
1834        public CodeableConcept getCategory() { 
1835          if (this.category == null)
1836            if (Configuration.errorOnAutoCreate())
1837              throw new Error("Attempt to auto-create AddedItemComponent.category");
1838            else if (Configuration.doAutoCreate())
1839              this.category = new CodeableConcept(); // cc
1840          return this.category;
1841        }
1842
1843        public boolean hasCategory() { 
1844          return this.category != null && !this.category.isEmpty();
1845        }
1846
1847        /**
1848         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
1849         */
1850        public AddedItemComponent setCategory(CodeableConcept value) { 
1851          this.category = value;
1852          return this;
1853        }
1854
1855        /**
1856         * @return {@link #service} (A code to indicate the Professional Service or Product supplied.)
1857         */
1858        public CodeableConcept getService() { 
1859          if (this.service == null)
1860            if (Configuration.errorOnAutoCreate())
1861              throw new Error("Attempt to auto-create AddedItemComponent.service");
1862            else if (Configuration.doAutoCreate())
1863              this.service = new CodeableConcept(); // cc
1864          return this.service;
1865        }
1866
1867        public boolean hasService() { 
1868          return this.service != null && !this.service.isEmpty();
1869        }
1870
1871        /**
1872         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied.)
1873         */
1874        public AddedItemComponent setService(CodeableConcept value) { 
1875          this.service = value;
1876          return this;
1877        }
1878
1879        /**
1880         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
1881         */
1882        public List<CodeableConcept> getModifier() { 
1883          if (this.modifier == null)
1884            this.modifier = new ArrayList<CodeableConcept>();
1885          return this.modifier;
1886        }
1887
1888        /**
1889         * @return Returns a reference to <code>this</code> for easy method chaining
1890         */
1891        public AddedItemComponent setModifier(List<CodeableConcept> theModifier) { 
1892          this.modifier = theModifier;
1893          return this;
1894        }
1895
1896        public boolean hasModifier() { 
1897          if (this.modifier == null)
1898            return false;
1899          for (CodeableConcept item : this.modifier)
1900            if (!item.isEmpty())
1901              return true;
1902          return false;
1903        }
1904
1905        public CodeableConcept addModifier() { //3
1906          CodeableConcept t = new CodeableConcept();
1907          if (this.modifier == null)
1908            this.modifier = new ArrayList<CodeableConcept>();
1909          this.modifier.add(t);
1910          return t;
1911        }
1912
1913        public AddedItemComponent addModifier(CodeableConcept t) { //3
1914          if (t == null)
1915            return this;
1916          if (this.modifier == null)
1917            this.modifier = new ArrayList<CodeableConcept>();
1918          this.modifier.add(t);
1919          return this;
1920        }
1921
1922        /**
1923         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
1924         */
1925        public CodeableConcept getModifierFirstRep() { 
1926          if (getModifier().isEmpty()) {
1927            addModifier();
1928          }
1929          return getModifier().get(0);
1930        }
1931
1932        /**
1933         * @return {@link #fee} (The fee charged for the professional service or product..)
1934         */
1935        public Money getFee() { 
1936          if (this.fee == null)
1937            if (Configuration.errorOnAutoCreate())
1938              throw new Error("Attempt to auto-create AddedItemComponent.fee");
1939            else if (Configuration.doAutoCreate())
1940              this.fee = new Money(); // cc
1941          return this.fee;
1942        }
1943
1944        public boolean hasFee() { 
1945          return this.fee != null && !this.fee.isEmpty();
1946        }
1947
1948        /**
1949         * @param value {@link #fee} (The fee charged for the professional service or product..)
1950         */
1951        public AddedItemComponent setFee(Money value) { 
1952          this.fee = value;
1953          return this;
1954        }
1955
1956        /**
1957         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
1958         */
1959        public List<PositiveIntType> getNoteNumber() { 
1960          if (this.noteNumber == null)
1961            this.noteNumber = new ArrayList<PositiveIntType>();
1962          return this.noteNumber;
1963        }
1964
1965        /**
1966         * @return Returns a reference to <code>this</code> for easy method chaining
1967         */
1968        public AddedItemComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
1969          this.noteNumber = theNoteNumber;
1970          return this;
1971        }
1972
1973        public boolean hasNoteNumber() { 
1974          if (this.noteNumber == null)
1975            return false;
1976          for (PositiveIntType item : this.noteNumber)
1977            if (!item.isEmpty())
1978              return true;
1979          return false;
1980        }
1981
1982        /**
1983         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
1984         */
1985        public PositiveIntType addNoteNumberElement() {//2 
1986          PositiveIntType t = new PositiveIntType();
1987          if (this.noteNumber == null)
1988            this.noteNumber = new ArrayList<PositiveIntType>();
1989          this.noteNumber.add(t);
1990          return t;
1991        }
1992
1993        /**
1994         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
1995         */
1996        public AddedItemComponent addNoteNumber(int value) { //1
1997          PositiveIntType t = new PositiveIntType();
1998          t.setValue(value);
1999          if (this.noteNumber == null)
2000            this.noteNumber = new ArrayList<PositiveIntType>();
2001          this.noteNumber.add(t);
2002          return this;
2003        }
2004
2005        /**
2006         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
2007         */
2008        public boolean hasNoteNumber(int value) { 
2009          if (this.noteNumber == null)
2010            return false;
2011          for (PositiveIntType v : this.noteNumber)
2012            if (v.equals(value)) // positiveInt
2013              return true;
2014          return false;
2015        }
2016
2017        /**
2018         * @return {@link #adjudication} (The adjudications results.)
2019         */
2020        public List<AdjudicationComponent> getAdjudication() { 
2021          if (this.adjudication == null)
2022            this.adjudication = new ArrayList<AdjudicationComponent>();
2023          return this.adjudication;
2024        }
2025
2026        /**
2027         * @return Returns a reference to <code>this</code> for easy method chaining
2028         */
2029        public AddedItemComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
2030          this.adjudication = theAdjudication;
2031          return this;
2032        }
2033
2034        public boolean hasAdjudication() { 
2035          if (this.adjudication == null)
2036            return false;
2037          for (AdjudicationComponent item : this.adjudication)
2038            if (!item.isEmpty())
2039              return true;
2040          return false;
2041        }
2042
2043        public AdjudicationComponent addAdjudication() { //3
2044          AdjudicationComponent t = new AdjudicationComponent();
2045          if (this.adjudication == null)
2046            this.adjudication = new ArrayList<AdjudicationComponent>();
2047          this.adjudication.add(t);
2048          return t;
2049        }
2050
2051        public AddedItemComponent addAdjudication(AdjudicationComponent t) { //3
2052          if (t == null)
2053            return this;
2054          if (this.adjudication == null)
2055            this.adjudication = new ArrayList<AdjudicationComponent>();
2056          this.adjudication.add(t);
2057          return this;
2058        }
2059
2060        /**
2061         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
2062         */
2063        public AdjudicationComponent getAdjudicationFirstRep() { 
2064          if (getAdjudication().isEmpty()) {
2065            addAdjudication();
2066          }
2067          return getAdjudication().get(0);
2068        }
2069
2070        /**
2071         * @return {@link #detail} (The second tier service adjudications for payor added services.)
2072         */
2073        public List<AddedItemsDetailComponent> getDetail() { 
2074          if (this.detail == null)
2075            this.detail = new ArrayList<AddedItemsDetailComponent>();
2076          return this.detail;
2077        }
2078
2079        /**
2080         * @return Returns a reference to <code>this</code> for easy method chaining
2081         */
2082        public AddedItemComponent setDetail(List<AddedItemsDetailComponent> theDetail) { 
2083          this.detail = theDetail;
2084          return this;
2085        }
2086
2087        public boolean hasDetail() { 
2088          if (this.detail == null)
2089            return false;
2090          for (AddedItemsDetailComponent item : this.detail)
2091            if (!item.isEmpty())
2092              return true;
2093          return false;
2094        }
2095
2096        public AddedItemsDetailComponent addDetail() { //3
2097          AddedItemsDetailComponent t = new AddedItemsDetailComponent();
2098          if (this.detail == null)
2099            this.detail = new ArrayList<AddedItemsDetailComponent>();
2100          this.detail.add(t);
2101          return t;
2102        }
2103
2104        public AddedItemComponent addDetail(AddedItemsDetailComponent t) { //3
2105          if (t == null)
2106            return this;
2107          if (this.detail == null)
2108            this.detail = new ArrayList<AddedItemsDetailComponent>();
2109          this.detail.add(t);
2110          return this;
2111        }
2112
2113        /**
2114         * @return The first repetition of repeating field {@link #detail}, creating it if it does not already exist
2115         */
2116        public AddedItemsDetailComponent getDetailFirstRep() { 
2117          if (getDetail().isEmpty()) {
2118            addDetail();
2119          }
2120          return getDetail().get(0);
2121        }
2122
2123        protected void listChildren(List<Property> childrenList) {
2124          super.listChildren(childrenList);
2125          childrenList.add(new Property("sequenceLinkId", "positiveInt", "List of input service items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
2126          childrenList.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, java.lang.Integer.MAX_VALUE, revenue));
2127          childrenList.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, java.lang.Integer.MAX_VALUE, category));
2128          childrenList.add(new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
2129          childrenList.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
2130          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product..", 0, java.lang.Integer.MAX_VALUE, fee));
2131          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
2132          childrenList.add(new Property("adjudication", "@ClaimResponse.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
2133          childrenList.add(new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
2134        }
2135
2136      @Override
2137      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2138        switch (hash) {
2139        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : this.sequenceLinkId.toArray(new Base[this.sequenceLinkId.size()]); // PositiveIntType
2140        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
2141        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
2142        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
2143        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
2144        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
2145        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
2146        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
2147        case -1335224239: /*detail*/ return this.detail == null ? new Base[0] : this.detail.toArray(new Base[this.detail.size()]); // AddedItemsDetailComponent
2148        default: return super.getProperty(hash, name, checkValid);
2149        }
2150
2151      }
2152
2153      @Override
2154      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2155        switch (hash) {
2156        case -1422298666: // sequenceLinkId
2157          this.getSequenceLinkId().add(castToPositiveInt(value)); // PositiveIntType
2158          return value;
2159        case 1099842588: // revenue
2160          this.revenue = castToCodeableConcept(value); // CodeableConcept
2161          return value;
2162        case 50511102: // category
2163          this.category = castToCodeableConcept(value); // CodeableConcept
2164          return value;
2165        case 1984153269: // service
2166          this.service = castToCodeableConcept(value); // CodeableConcept
2167          return value;
2168        case -615513385: // modifier
2169          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
2170          return value;
2171        case 101254: // fee
2172          this.fee = castToMoney(value); // Money
2173          return value;
2174        case -1110033957: // noteNumber
2175          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
2176          return value;
2177        case -231349275: // adjudication
2178          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
2179          return value;
2180        case -1335224239: // detail
2181          this.getDetail().add((AddedItemsDetailComponent) value); // AddedItemsDetailComponent
2182          return value;
2183        default: return super.setProperty(hash, name, value);
2184        }
2185
2186      }
2187
2188      @Override
2189      public Base setProperty(String name, Base value) throws FHIRException {
2190        if (name.equals("sequenceLinkId")) {
2191          this.getSequenceLinkId().add(castToPositiveInt(value));
2192        } else if (name.equals("revenue")) {
2193          this.revenue = castToCodeableConcept(value); // CodeableConcept
2194        } else if (name.equals("category")) {
2195          this.category = castToCodeableConcept(value); // CodeableConcept
2196        } else if (name.equals("service")) {
2197          this.service = castToCodeableConcept(value); // CodeableConcept
2198        } else if (name.equals("modifier")) {
2199          this.getModifier().add(castToCodeableConcept(value));
2200        } else if (name.equals("fee")) {
2201          this.fee = castToMoney(value); // Money
2202        } else if (name.equals("noteNumber")) {
2203          this.getNoteNumber().add(castToPositiveInt(value));
2204        } else if (name.equals("adjudication")) {
2205          this.getAdjudication().add((AdjudicationComponent) value);
2206        } else if (name.equals("detail")) {
2207          this.getDetail().add((AddedItemsDetailComponent) value);
2208        } else
2209          return super.setProperty(name, value);
2210        return value;
2211      }
2212
2213      @Override
2214      public Base makeProperty(int hash, String name) throws FHIRException {
2215        switch (hash) {
2216        case -1422298666:  return addSequenceLinkIdElement();
2217        case 1099842588:  return getRevenue(); 
2218        case 50511102:  return getCategory(); 
2219        case 1984153269:  return getService(); 
2220        case -615513385:  return addModifier(); 
2221        case 101254:  return getFee(); 
2222        case -1110033957:  return addNoteNumberElement();
2223        case -231349275:  return addAdjudication(); 
2224        case -1335224239:  return addDetail(); 
2225        default: return super.makeProperty(hash, name);
2226        }
2227
2228      }
2229
2230      @Override
2231      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2232        switch (hash) {
2233        case -1422298666: /*sequenceLinkId*/ return new String[] {"positiveInt"};
2234        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
2235        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2236        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
2237        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
2238        case 101254: /*fee*/ return new String[] {"Money"};
2239        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
2240        case -231349275: /*adjudication*/ return new String[] {"@ClaimResponse.item.adjudication"};
2241        case -1335224239: /*detail*/ return new String[] {};
2242        default: return super.getTypesForProperty(hash, name);
2243        }
2244
2245      }
2246
2247      @Override
2248      public Base addChild(String name) throws FHIRException {
2249        if (name.equals("sequenceLinkId")) {
2250          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
2251        }
2252        else if (name.equals("revenue")) {
2253          this.revenue = new CodeableConcept();
2254          return this.revenue;
2255        }
2256        else if (name.equals("category")) {
2257          this.category = new CodeableConcept();
2258          return this.category;
2259        }
2260        else if (name.equals("service")) {
2261          this.service = new CodeableConcept();
2262          return this.service;
2263        }
2264        else if (name.equals("modifier")) {
2265          return addModifier();
2266        }
2267        else if (name.equals("fee")) {
2268          this.fee = new Money();
2269          return this.fee;
2270        }
2271        else if (name.equals("noteNumber")) {
2272          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.noteNumber");
2273        }
2274        else if (name.equals("adjudication")) {
2275          return addAdjudication();
2276        }
2277        else if (name.equals("detail")) {
2278          return addDetail();
2279        }
2280        else
2281          return super.addChild(name);
2282      }
2283
2284      public AddedItemComponent copy() {
2285        AddedItemComponent dst = new AddedItemComponent();
2286        copyValues(dst);
2287        if (sequenceLinkId != null) {
2288          dst.sequenceLinkId = new ArrayList<PositiveIntType>();
2289          for (PositiveIntType i : sequenceLinkId)
2290            dst.sequenceLinkId.add(i.copy());
2291        };
2292        dst.revenue = revenue == null ? null : revenue.copy();
2293        dst.category = category == null ? null : category.copy();
2294        dst.service = service == null ? null : service.copy();
2295        if (modifier != null) {
2296          dst.modifier = new ArrayList<CodeableConcept>();
2297          for (CodeableConcept i : modifier)
2298            dst.modifier.add(i.copy());
2299        };
2300        dst.fee = fee == null ? null : fee.copy();
2301        if (noteNumber != null) {
2302          dst.noteNumber = new ArrayList<PositiveIntType>();
2303          for (PositiveIntType i : noteNumber)
2304            dst.noteNumber.add(i.copy());
2305        };
2306        if (adjudication != null) {
2307          dst.adjudication = new ArrayList<AdjudicationComponent>();
2308          for (AdjudicationComponent i : adjudication)
2309            dst.adjudication.add(i.copy());
2310        };
2311        if (detail != null) {
2312          dst.detail = new ArrayList<AddedItemsDetailComponent>();
2313          for (AddedItemsDetailComponent i : detail)
2314            dst.detail.add(i.copy());
2315        };
2316        return dst;
2317      }
2318
2319      @Override
2320      public boolean equalsDeep(Base other) {
2321        if (!super.equalsDeep(other))
2322          return false;
2323        if (!(other instanceof AddedItemComponent))
2324          return false;
2325        AddedItemComponent o = (AddedItemComponent) other;
2326        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(revenue, o.revenue, true)
2327           && compareDeep(category, o.category, true) && compareDeep(service, o.service, true) && compareDeep(modifier, o.modifier, true)
2328           && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true) && compareDeep(adjudication, o.adjudication, true)
2329           && compareDeep(detail, o.detail, true);
2330      }
2331
2332      @Override
2333      public boolean equalsShallow(Base other) {
2334        if (!super.equalsShallow(other))
2335          return false;
2336        if (!(other instanceof AddedItemComponent))
2337          return false;
2338        AddedItemComponent o = (AddedItemComponent) other;
2339        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumber, o.noteNumber, true)
2340          ;
2341      }
2342
2343      public boolean isEmpty() {
2344        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceLinkId, revenue, category
2345          , service, modifier, fee, noteNumber, adjudication, detail);
2346      }
2347
2348  public String fhirType() {
2349    return "ClaimResponse.addItem";
2350
2351  }
2352
2353  }
2354
2355    @Block()
2356    public static class AddedItemsDetailComponent extends BackboneElement implements IBaseBackboneElement {
2357        /**
2358         * The type of reveneu or cost center providing the product and/or service.
2359         */
2360        @Child(name = "revenue", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
2361        @Description(shortDefinition="Revenue or cost center code", formalDefinition="The type of reveneu or cost center providing the product and/or service." )
2362        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-revenue-center")
2363        protected CodeableConcept revenue;
2364
2365        /**
2366         * Health Care Service Type Codes  to identify the classification of service or benefits.
2367         */
2368        @Child(name = "category", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
2369        @Description(shortDefinition="Type of service or product", formalDefinition="Health Care Service Type Codes  to identify the classification of service or benefits." )
2370        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/benefit-subcategory")
2371        protected CodeableConcept category;
2372
2373        /**
2374         * A code to indicate the Professional Service or Product supplied.
2375         */
2376        @Child(name = "service", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
2377        @Description(shortDefinition="Service or Product", formalDefinition="A code to indicate the Professional Service or Product supplied." )
2378        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/service-uscls")
2379        protected CodeableConcept service;
2380
2381        /**
2382         * Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.
2383         */
2384        @Child(name = "modifier", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2385        @Description(shortDefinition="Service/Product billing modifiers", formalDefinition="Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours." )
2386        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/claim-modifiers")
2387        protected List<CodeableConcept> modifier;
2388
2389        /**
2390         * The fee charged for the professional service or product..
2391         */
2392        @Child(name = "fee", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
2393        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product.." )
2394        protected Money fee;
2395
2396        /**
2397         * A list of note references to the notes provided below.
2398         */
2399        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2400        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
2401        protected List<PositiveIntType> noteNumber;
2402
2403        /**
2404         * The adjudications results.
2405         */
2406        @Child(name = "adjudication", type = {AdjudicationComponent.class}, order=7, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
2407        @Description(shortDefinition="Added items detail adjudication", formalDefinition="The adjudications results." )
2408        protected List<AdjudicationComponent> adjudication;
2409
2410        private static final long serialVersionUID = -311484980L;
2411
2412    /**
2413     * Constructor
2414     */
2415      public AddedItemsDetailComponent() {
2416        super();
2417      }
2418
2419        /**
2420         * @return {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
2421         */
2422        public CodeableConcept getRevenue() { 
2423          if (this.revenue == null)
2424            if (Configuration.errorOnAutoCreate())
2425              throw new Error("Attempt to auto-create AddedItemsDetailComponent.revenue");
2426            else if (Configuration.doAutoCreate())
2427              this.revenue = new CodeableConcept(); // cc
2428          return this.revenue;
2429        }
2430
2431        public boolean hasRevenue() { 
2432          return this.revenue != null && !this.revenue.isEmpty();
2433        }
2434
2435        /**
2436         * @param value {@link #revenue} (The type of reveneu or cost center providing the product and/or service.)
2437         */
2438        public AddedItemsDetailComponent setRevenue(CodeableConcept value) { 
2439          this.revenue = value;
2440          return this;
2441        }
2442
2443        /**
2444         * @return {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
2445         */
2446        public CodeableConcept getCategory() { 
2447          if (this.category == null)
2448            if (Configuration.errorOnAutoCreate())
2449              throw new Error("Attempt to auto-create AddedItemsDetailComponent.category");
2450            else if (Configuration.doAutoCreate())
2451              this.category = new CodeableConcept(); // cc
2452          return this.category;
2453        }
2454
2455        public boolean hasCategory() { 
2456          return this.category != null && !this.category.isEmpty();
2457        }
2458
2459        /**
2460         * @param value {@link #category} (Health Care Service Type Codes  to identify the classification of service or benefits.)
2461         */
2462        public AddedItemsDetailComponent setCategory(CodeableConcept value) { 
2463          this.category = value;
2464          return this;
2465        }
2466
2467        /**
2468         * @return {@link #service} (A code to indicate the Professional Service or Product supplied.)
2469         */
2470        public CodeableConcept getService() { 
2471          if (this.service == null)
2472            if (Configuration.errorOnAutoCreate())
2473              throw new Error("Attempt to auto-create AddedItemsDetailComponent.service");
2474            else if (Configuration.doAutoCreate())
2475              this.service = new CodeableConcept(); // cc
2476          return this.service;
2477        }
2478
2479        public boolean hasService() { 
2480          return this.service != null && !this.service.isEmpty();
2481        }
2482
2483        /**
2484         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied.)
2485         */
2486        public AddedItemsDetailComponent setService(CodeableConcept value) { 
2487          this.service = value;
2488          return this;
2489        }
2490
2491        /**
2492         * @return {@link #modifier} (Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.)
2493         */
2494        public List<CodeableConcept> getModifier() { 
2495          if (this.modifier == null)
2496            this.modifier = new ArrayList<CodeableConcept>();
2497          return this.modifier;
2498        }
2499
2500        /**
2501         * @return Returns a reference to <code>this</code> for easy method chaining
2502         */
2503        public AddedItemsDetailComponent setModifier(List<CodeableConcept> theModifier) { 
2504          this.modifier = theModifier;
2505          return this;
2506        }
2507
2508        public boolean hasModifier() { 
2509          if (this.modifier == null)
2510            return false;
2511          for (CodeableConcept item : this.modifier)
2512            if (!item.isEmpty())
2513              return true;
2514          return false;
2515        }
2516
2517        public CodeableConcept addModifier() { //3
2518          CodeableConcept t = new CodeableConcept();
2519          if (this.modifier == null)
2520            this.modifier = new ArrayList<CodeableConcept>();
2521          this.modifier.add(t);
2522          return t;
2523        }
2524
2525        public AddedItemsDetailComponent addModifier(CodeableConcept t) { //3
2526          if (t == null)
2527            return this;
2528          if (this.modifier == null)
2529            this.modifier = new ArrayList<CodeableConcept>();
2530          this.modifier.add(t);
2531          return this;
2532        }
2533
2534        /**
2535         * @return The first repetition of repeating field {@link #modifier}, creating it if it does not already exist
2536         */
2537        public CodeableConcept getModifierFirstRep() { 
2538          if (getModifier().isEmpty()) {
2539            addModifier();
2540          }
2541          return getModifier().get(0);
2542        }
2543
2544        /**
2545         * @return {@link #fee} (The fee charged for the professional service or product..)
2546         */
2547        public Money getFee() { 
2548          if (this.fee == null)
2549            if (Configuration.errorOnAutoCreate())
2550              throw new Error("Attempt to auto-create AddedItemsDetailComponent.fee");
2551            else if (Configuration.doAutoCreate())
2552              this.fee = new Money(); // cc
2553          return this.fee;
2554        }
2555
2556        public boolean hasFee() { 
2557          return this.fee != null && !this.fee.isEmpty();
2558        }
2559
2560        /**
2561         * @param value {@link #fee} (The fee charged for the professional service or product..)
2562         */
2563        public AddedItemsDetailComponent setFee(Money value) { 
2564          this.fee = value;
2565          return this;
2566        }
2567
2568        /**
2569         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
2570         */
2571        public List<PositiveIntType> getNoteNumber() { 
2572          if (this.noteNumber == null)
2573            this.noteNumber = new ArrayList<PositiveIntType>();
2574          return this.noteNumber;
2575        }
2576
2577        /**
2578         * @return Returns a reference to <code>this</code> for easy method chaining
2579         */
2580        public AddedItemsDetailComponent setNoteNumber(List<PositiveIntType> theNoteNumber) { 
2581          this.noteNumber = theNoteNumber;
2582          return this;
2583        }
2584
2585        public boolean hasNoteNumber() { 
2586          if (this.noteNumber == null)
2587            return false;
2588          for (PositiveIntType item : this.noteNumber)
2589            if (!item.isEmpty())
2590              return true;
2591          return false;
2592        }
2593
2594        /**
2595         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
2596         */
2597        public PositiveIntType addNoteNumberElement() {//2 
2598          PositiveIntType t = new PositiveIntType();
2599          if (this.noteNumber == null)
2600            this.noteNumber = new ArrayList<PositiveIntType>();
2601          this.noteNumber.add(t);
2602          return t;
2603        }
2604
2605        /**
2606         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
2607         */
2608        public AddedItemsDetailComponent addNoteNumber(int value) { //1
2609          PositiveIntType t = new PositiveIntType();
2610          t.setValue(value);
2611          if (this.noteNumber == null)
2612            this.noteNumber = new ArrayList<PositiveIntType>();
2613          this.noteNumber.add(t);
2614          return this;
2615        }
2616
2617        /**
2618         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
2619         */
2620        public boolean hasNoteNumber(int value) { 
2621          if (this.noteNumber == null)
2622            return false;
2623          for (PositiveIntType v : this.noteNumber)
2624            if (v.equals(value)) // positiveInt
2625              return true;
2626          return false;
2627        }
2628
2629        /**
2630         * @return {@link #adjudication} (The adjudications results.)
2631         */
2632        public List<AdjudicationComponent> getAdjudication() { 
2633          if (this.adjudication == null)
2634            this.adjudication = new ArrayList<AdjudicationComponent>();
2635          return this.adjudication;
2636        }
2637
2638        /**
2639         * @return Returns a reference to <code>this</code> for easy method chaining
2640         */
2641        public AddedItemsDetailComponent setAdjudication(List<AdjudicationComponent> theAdjudication) { 
2642          this.adjudication = theAdjudication;
2643          return this;
2644        }
2645
2646        public boolean hasAdjudication() { 
2647          if (this.adjudication == null)
2648            return false;
2649          for (AdjudicationComponent item : this.adjudication)
2650            if (!item.isEmpty())
2651              return true;
2652          return false;
2653        }
2654
2655        public AdjudicationComponent addAdjudication() { //3
2656          AdjudicationComponent t = new AdjudicationComponent();
2657          if (this.adjudication == null)
2658            this.adjudication = new ArrayList<AdjudicationComponent>();
2659          this.adjudication.add(t);
2660          return t;
2661        }
2662
2663        public AddedItemsDetailComponent addAdjudication(AdjudicationComponent t) { //3
2664          if (t == null)
2665            return this;
2666          if (this.adjudication == null)
2667            this.adjudication = new ArrayList<AdjudicationComponent>();
2668          this.adjudication.add(t);
2669          return this;
2670        }
2671
2672        /**
2673         * @return The first repetition of repeating field {@link #adjudication}, creating it if it does not already exist
2674         */
2675        public AdjudicationComponent getAdjudicationFirstRep() { 
2676          if (getAdjudication().isEmpty()) {
2677            addAdjudication();
2678          }
2679          return getAdjudication().get(0);
2680        }
2681
2682        protected void listChildren(List<Property> childrenList) {
2683          super.listChildren(childrenList);
2684          childrenList.add(new Property("revenue", "CodeableConcept", "The type of reveneu or cost center providing the product and/or service.", 0, java.lang.Integer.MAX_VALUE, revenue));
2685          childrenList.add(new Property("category", "CodeableConcept", "Health Care Service Type Codes  to identify the classification of service or benefits.", 0, java.lang.Integer.MAX_VALUE, category));
2686          childrenList.add(new Property("service", "CodeableConcept", "A code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
2687          childrenList.add(new Property("modifier", "CodeableConcept", "Item typification or modifiers codes, eg for Oral whether the treatment is cosmetic or associated with TMJ, or for medical whether the treatment was outside the clinic or out of office hours.", 0, java.lang.Integer.MAX_VALUE, modifier));
2688          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product..", 0, java.lang.Integer.MAX_VALUE, fee));
2689          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
2690          childrenList.add(new Property("adjudication", "@ClaimResponse.item.adjudication", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
2691        }
2692
2693      @Override
2694      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
2695        switch (hash) {
2696        case 1099842588: /*revenue*/ return this.revenue == null ? new Base[0] : new Base[] {this.revenue}; // CodeableConcept
2697        case 50511102: /*category*/ return this.category == null ? new Base[0] : new Base[] {this.category}; // CodeableConcept
2698        case 1984153269: /*service*/ return this.service == null ? new Base[0] : new Base[] {this.service}; // CodeableConcept
2699        case -615513385: /*modifier*/ return this.modifier == null ? new Base[0] : this.modifier.toArray(new Base[this.modifier.size()]); // CodeableConcept
2700        case 101254: /*fee*/ return this.fee == null ? new Base[0] : new Base[] {this.fee}; // Money
2701        case -1110033957: /*noteNumber*/ return this.noteNumber == null ? new Base[0] : this.noteNumber.toArray(new Base[this.noteNumber.size()]); // PositiveIntType
2702        case -231349275: /*adjudication*/ return this.adjudication == null ? new Base[0] : this.adjudication.toArray(new Base[this.adjudication.size()]); // AdjudicationComponent
2703        default: return super.getProperty(hash, name, checkValid);
2704        }
2705
2706      }
2707
2708      @Override
2709      public Base setProperty(int hash, String name, Base value) throws FHIRException {
2710        switch (hash) {
2711        case 1099842588: // revenue
2712          this.revenue = castToCodeableConcept(value); // CodeableConcept
2713          return value;
2714        case 50511102: // category
2715          this.category = castToCodeableConcept(value); // CodeableConcept
2716          return value;
2717        case 1984153269: // service
2718          this.service = castToCodeableConcept(value); // CodeableConcept
2719          return value;
2720        case -615513385: // modifier
2721          this.getModifier().add(castToCodeableConcept(value)); // CodeableConcept
2722          return value;
2723        case 101254: // fee
2724          this.fee = castToMoney(value); // Money
2725          return value;
2726        case -1110033957: // noteNumber
2727          this.getNoteNumber().add(castToPositiveInt(value)); // PositiveIntType
2728          return value;
2729        case -231349275: // adjudication
2730          this.getAdjudication().add((AdjudicationComponent) value); // AdjudicationComponent
2731          return value;
2732        default: return super.setProperty(hash, name, value);
2733        }
2734
2735      }
2736
2737      @Override
2738      public Base setProperty(String name, Base value) throws FHIRException {
2739        if (name.equals("revenue")) {
2740          this.revenue = castToCodeableConcept(value); // CodeableConcept
2741        } else if (name.equals("category")) {
2742          this.category = castToCodeableConcept(value); // CodeableConcept
2743        } else if (name.equals("service")) {
2744          this.service = castToCodeableConcept(value); // CodeableConcept
2745        } else if (name.equals("modifier")) {
2746          this.getModifier().add(castToCodeableConcept(value));
2747        } else if (name.equals("fee")) {
2748          this.fee = castToMoney(value); // Money
2749        } else if (name.equals("noteNumber")) {
2750          this.getNoteNumber().add(castToPositiveInt(value));
2751        } else if (name.equals("adjudication")) {
2752          this.getAdjudication().add((AdjudicationComponent) value);
2753        } else
2754          return super.setProperty(name, value);
2755        return value;
2756      }
2757
2758      @Override
2759      public Base makeProperty(int hash, String name) throws FHIRException {
2760        switch (hash) {
2761        case 1099842588:  return getRevenue(); 
2762        case 50511102:  return getCategory(); 
2763        case 1984153269:  return getService(); 
2764        case -615513385:  return addModifier(); 
2765        case 101254:  return getFee(); 
2766        case -1110033957:  return addNoteNumberElement();
2767        case -231349275:  return addAdjudication(); 
2768        default: return super.makeProperty(hash, name);
2769        }
2770
2771      }
2772
2773      @Override
2774      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
2775        switch (hash) {
2776        case 1099842588: /*revenue*/ return new String[] {"CodeableConcept"};
2777        case 50511102: /*category*/ return new String[] {"CodeableConcept"};
2778        case 1984153269: /*service*/ return new String[] {"CodeableConcept"};
2779        case -615513385: /*modifier*/ return new String[] {"CodeableConcept"};
2780        case 101254: /*fee*/ return new String[] {"Money"};
2781        case -1110033957: /*noteNumber*/ return new String[] {"positiveInt"};
2782        case -231349275: /*adjudication*/ return new String[] {"@ClaimResponse.item.adjudication"};
2783        default: return super.getTypesForProperty(hash, name);
2784        }
2785
2786      }
2787
2788      @Override
2789      public Base addChild(String name) throws FHIRException {
2790        if (name.equals("revenue")) {
2791          this.revenue = new CodeableConcept();
2792          return this.revenue;
2793        }
2794        else if (name.equals("category")) {
2795          this.category = new CodeableConcept();
2796          return this.category;
2797        }
2798        else if (name.equals("service")) {
2799          this.service = new CodeableConcept();
2800          return this.service;
2801        }
2802        else if (name.equals("modifier")) {
2803          return addModifier();
2804        }
2805        else if (name.equals("fee")) {
2806          this.fee = new Money();
2807          return this.fee;
2808        }
2809        else if (name.equals("noteNumber")) {
2810          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.noteNumber");
2811        }
2812        else if (name.equals("adjudication")) {
2813          return addAdjudication();
2814        }
2815        else
2816          return super.addChild(name);
2817      }
2818
2819      public AddedItemsDetailComponent copy() {
2820        AddedItemsDetailComponent dst = new AddedItemsDetailComponent();
2821        copyValues(dst);
2822        dst.revenue = revenue == null ? null : revenue.copy();
2823        dst.category = category == null ? null : category.copy();
2824        dst.service = service == null ? null : service.copy();
2825        if (modifier != null) {
2826          dst.modifier = new ArrayList<CodeableConcept>();
2827          for (CodeableConcept i : modifier)
2828            dst.modifier.add(i.copy());
2829        };
2830        dst.fee = fee == null ? null : fee.copy();
2831        if (noteNumber != null) {
2832          dst.noteNumber = new ArrayList<PositiveIntType>();
2833          for (PositiveIntType i : noteNumber)
2834            dst.noteNumber.add(i.copy());
2835        };
2836        if (adjudication != null) {
2837          dst.adjudication = new ArrayList<AdjudicationComponent>();
2838          for (AdjudicationComponent i : adjudication)
2839            dst.adjudication.add(i.copy());
2840        };
2841        return dst;
2842      }
2843
2844      @Override
2845      public boolean equalsDeep(Base other) {
2846        if (!super.equalsDeep(other))
2847          return false;
2848        if (!(other instanceof AddedItemsDetailComponent))
2849          return false;
2850        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
2851        return compareDeep(revenue, o.revenue, true) && compareDeep(category, o.category, true) && compareDeep(service, o.service, true)
2852           && compareDeep(modifier, o.modifier, true) && compareDeep(fee, o.fee, true) && compareDeep(noteNumber, o.noteNumber, true)
2853           && compareDeep(adjudication, o.adjudication, true);
2854      }
2855
2856      @Override
2857      public boolean equalsShallow(Base other) {
2858        if (!super.equalsShallow(other))
2859          return false;
2860        if (!(other instanceof AddedItemsDetailComponent))
2861          return false;
2862        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
2863        return compareValues(noteNumber, o.noteNumber, true);
2864      }
2865
2866      public boolean isEmpty() {
2867        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(revenue, category, service
2868          , modifier, fee, noteNumber, adjudication);
2869      }
2870
2871  public String fhirType() {
2872    return "ClaimResponse.addItem.detail";
2873
2874  }
2875
2876  }
2877
2878    @Block()
2879    public static class ErrorComponent extends BackboneElement implements IBaseBackboneElement {
2880        /**
2881         * The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.
2882         */
2883        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
2884        @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 is elsewhere." )
2885        protected PositiveIntType sequenceLinkId;
2886
2887        /**
2888         * The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
2889         */
2890        @Child(name = "detailSequenceLinkId", type = {PositiveIntType.class}, order=2, min=0, max=1, modifier=false, summary=false)
2891        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition." )
2892        protected PositiveIntType detailSequenceLinkId;
2893
2894        /**
2895         * The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
2896         */
2897        @Child(name = "subdetailSequenceLinkId", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=false)
2898        @Description(shortDefinition="Subdetail sequence number", formalDefinition="The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition." )
2899        protected PositiveIntType subdetailSequenceLinkId;
2900
2901        /**
2902         * An error code,from a specified code system, which details why the claim could not be adjudicated.
2903         */
2904        @Child(name = "code", type = {CodeableConcept.class}, order=4, min=1, max=1, modifier=false, summary=false)
2905        @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." )
2906        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/adjudication-error")
2907        protected CodeableConcept code;
2908
2909        private static final long serialVersionUID = -1379670472L;
2910
2911    /**
2912     * Constructor
2913     */
2914      public ErrorComponent() {
2915        super();
2916      }
2917
2918    /**
2919     * Constructor
2920     */
2921      public ErrorComponent(CodeableConcept code) {
2922        super();
2923        this.code = code;
2924      }
2925
2926        /**
2927         * @return {@link #sequenceLinkId} (The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
2928         */
2929        public PositiveIntType getSequenceLinkIdElement() { 
2930          if (this.sequenceLinkId == null)
2931            if (Configuration.errorOnAutoCreate())
2932              throw new Error("Attempt to auto-create ErrorComponent.sequenceLinkId");
2933            else if (Configuration.doAutoCreate())
2934              this.sequenceLinkId = new PositiveIntType(); // bb
2935          return this.sequenceLinkId;
2936        }
2937
2938        public boolean hasSequenceLinkIdElement() { 
2939          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
2940        }
2941
2942        public boolean hasSequenceLinkId() { 
2943          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
2944        }
2945
2946        /**
2947         * @param value {@link #sequenceLinkId} (The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
2948         */
2949        public ErrorComponent setSequenceLinkIdElement(PositiveIntType value) { 
2950          this.sequenceLinkId = value;
2951          return this;
2952        }
2953
2954        /**
2955         * @return The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.
2956         */
2957        public int getSequenceLinkId() { 
2958          return this.sequenceLinkId == null || this.sequenceLinkId.isEmpty() ? 0 : this.sequenceLinkId.getValue();
2959        }
2960
2961        /**
2962         * @param value The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.
2963         */
2964        public ErrorComponent setSequenceLinkId(int value) { 
2965            if (this.sequenceLinkId == null)
2966              this.sequenceLinkId = new PositiveIntType();
2967            this.sequenceLinkId.setValue(value);
2968          return this;
2969        }
2970
2971        /**
2972         * @return {@link #detailSequenceLinkId} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.). This is the underlying object with id, value and extensions. The accessor "getDetailSequenceLinkId" gives direct access to the value
2973         */
2974        public PositiveIntType getDetailSequenceLinkIdElement() { 
2975          if (this.detailSequenceLinkId == null)
2976            if (Configuration.errorOnAutoCreate())
2977              throw new Error("Attempt to auto-create ErrorComponent.detailSequenceLinkId");
2978            else if (Configuration.doAutoCreate())
2979              this.detailSequenceLinkId = new PositiveIntType(); // bb
2980          return this.detailSequenceLinkId;
2981        }
2982
2983        public boolean hasDetailSequenceLinkIdElement() { 
2984          return this.detailSequenceLinkId != null && !this.detailSequenceLinkId.isEmpty();
2985        }
2986
2987        public boolean hasDetailSequenceLinkId() { 
2988          return this.detailSequenceLinkId != null && !this.detailSequenceLinkId.isEmpty();
2989        }
2990
2991        /**
2992         * @param value {@link #detailSequenceLinkId} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.). This is the underlying object with id, value and extensions. The accessor "getDetailSequenceLinkId" gives direct access to the value
2993         */
2994        public ErrorComponent setDetailSequenceLinkIdElement(PositiveIntType value) { 
2995          this.detailSequenceLinkId = value;
2996          return this;
2997        }
2998
2999        /**
3000         * @return The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
3001         */
3002        public int getDetailSequenceLinkId() { 
3003          return this.detailSequenceLinkId == null || this.detailSequenceLinkId.isEmpty() ? 0 : this.detailSequenceLinkId.getValue();
3004        }
3005
3006        /**
3007         * @param value The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
3008         */
3009        public ErrorComponent setDetailSequenceLinkId(int value) { 
3010            if (this.detailSequenceLinkId == null)
3011              this.detailSequenceLinkId = new PositiveIntType();
3012            this.detailSequenceLinkId.setValue(value);
3013          return this;
3014        }
3015
3016        /**
3017         * @return {@link #subdetailSequenceLinkId} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.). This is the underlying object with id, value and extensions. The accessor "getSubdetailSequenceLinkId" gives direct access to the value
3018         */
3019        public PositiveIntType getSubdetailSequenceLinkIdElement() { 
3020          if (this.subdetailSequenceLinkId == null)
3021            if (Configuration.errorOnAutoCreate())
3022              throw new Error("Attempt to auto-create ErrorComponent.subdetailSequenceLinkId");
3023            else if (Configuration.doAutoCreate())
3024              this.subdetailSequenceLinkId = new PositiveIntType(); // bb
3025          return this.subdetailSequenceLinkId;
3026        }
3027
3028        public boolean hasSubdetailSequenceLinkIdElement() { 
3029          return this.subdetailSequenceLinkId != null && !this.subdetailSequenceLinkId.isEmpty();
3030        }
3031
3032        public boolean hasSubdetailSequenceLinkId() { 
3033          return this.subdetailSequenceLinkId != null && !this.subdetailSequenceLinkId.isEmpty();
3034        }
3035
3036        /**
3037         * @param value {@link #subdetailSequenceLinkId} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.). This is the underlying object with id, value and extensions. The accessor "getSubdetailSequenceLinkId" gives direct access to the value
3038         */
3039        public ErrorComponent setSubdetailSequenceLinkIdElement(PositiveIntType value) { 
3040          this.subdetailSequenceLinkId = value;
3041          return this;
3042        }
3043
3044        /**
3045         * @return The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
3046         */
3047        public int getSubdetailSequenceLinkId() { 
3048          return this.subdetailSequenceLinkId == null || this.subdetailSequenceLinkId.isEmpty() ? 0 : this.subdetailSequenceLinkId.getValue();
3049        }
3050
3051        /**
3052         * @param value The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
3053         */
3054        public ErrorComponent setSubdetailSequenceLinkId(int value) { 
3055            if (this.subdetailSequenceLinkId == null)
3056              this.subdetailSequenceLinkId = new PositiveIntType();
3057            this.subdetailSequenceLinkId.setValue(value);
3058          return this;
3059        }
3060
3061        /**
3062         * @return {@link #code} (An error code,from a specified code system, which details why the claim could not be adjudicated.)
3063         */
3064        public CodeableConcept getCode() { 
3065          if (this.code == null)
3066            if (Configuration.errorOnAutoCreate())
3067              throw new Error("Attempt to auto-create ErrorComponent.code");
3068            else if (Configuration.doAutoCreate())
3069              this.code = new CodeableConcept(); // cc
3070          return this.code;
3071        }
3072
3073        public boolean hasCode() { 
3074          return this.code != null && !this.code.isEmpty();
3075        }
3076
3077        /**
3078         * @param value {@link #code} (An error code,from a specified code system, which details why the claim could not be adjudicated.)
3079         */
3080        public ErrorComponent setCode(CodeableConcept value) { 
3081          this.code = value;
3082          return this;
3083        }
3084
3085        protected void listChildren(List<Property> childrenList) {
3086          super.listChildren(childrenList);
3087          childrenList.add(new Property("sequenceLinkId", "positiveInt", "The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
3088          childrenList.add(new Property("detailSequenceLinkId", "positiveInt", "The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.", 0, java.lang.Integer.MAX_VALUE, detailSequenceLinkId));
3089          childrenList.add(new Property("subdetailSequenceLinkId", "positiveInt", "The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.", 0, java.lang.Integer.MAX_VALUE, subdetailSequenceLinkId));
3090          childrenList.add(new Property("code", "CodeableConcept", "An error code,from a specified code system, which details why the claim could not be adjudicated.", 0, java.lang.Integer.MAX_VALUE, code));
3091        }
3092
3093      @Override
3094      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3095        switch (hash) {
3096        case -1422298666: /*sequenceLinkId*/ return this.sequenceLinkId == null ? new Base[0] : new Base[] {this.sequenceLinkId}; // PositiveIntType
3097        case 516748423: /*detailSequenceLinkId*/ return this.detailSequenceLinkId == null ? new Base[0] : new Base[] {this.detailSequenceLinkId}; // PositiveIntType
3098        case -1061088569: /*subdetailSequenceLinkId*/ return this.subdetailSequenceLinkId == null ? new Base[0] : new Base[] {this.subdetailSequenceLinkId}; // PositiveIntType
3099        case 3059181: /*code*/ return this.code == null ? new Base[0] : new Base[] {this.code}; // CodeableConcept
3100        default: return super.getProperty(hash, name, checkValid);
3101        }
3102
3103      }
3104
3105      @Override
3106      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3107        switch (hash) {
3108        case -1422298666: // sequenceLinkId
3109          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
3110          return value;
3111        case 516748423: // detailSequenceLinkId
3112          this.detailSequenceLinkId = castToPositiveInt(value); // PositiveIntType
3113          return value;
3114        case -1061088569: // subdetailSequenceLinkId
3115          this.subdetailSequenceLinkId = castToPositiveInt(value); // PositiveIntType
3116          return value;
3117        case 3059181: // code
3118          this.code = castToCodeableConcept(value); // CodeableConcept
3119          return value;
3120        default: return super.setProperty(hash, name, value);
3121        }
3122
3123      }
3124
3125      @Override
3126      public Base setProperty(String name, Base value) throws FHIRException {
3127        if (name.equals("sequenceLinkId")) {
3128          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
3129        } else if (name.equals("detailSequenceLinkId")) {
3130          this.detailSequenceLinkId = castToPositiveInt(value); // PositiveIntType
3131        } else if (name.equals("subdetailSequenceLinkId")) {
3132          this.subdetailSequenceLinkId = castToPositiveInt(value); // PositiveIntType
3133        } else if (name.equals("code")) {
3134          this.code = castToCodeableConcept(value); // CodeableConcept
3135        } else
3136          return super.setProperty(name, value);
3137        return value;
3138      }
3139
3140      @Override
3141      public Base makeProperty(int hash, String name) throws FHIRException {
3142        switch (hash) {
3143        case -1422298666:  return getSequenceLinkIdElement();
3144        case 516748423:  return getDetailSequenceLinkIdElement();
3145        case -1061088569:  return getSubdetailSequenceLinkIdElement();
3146        case 3059181:  return getCode(); 
3147        default: return super.makeProperty(hash, name);
3148        }
3149
3150      }
3151
3152      @Override
3153      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3154        switch (hash) {
3155        case -1422298666: /*sequenceLinkId*/ return new String[] {"positiveInt"};
3156        case 516748423: /*detailSequenceLinkId*/ return new String[] {"positiveInt"};
3157        case -1061088569: /*subdetailSequenceLinkId*/ return new String[] {"positiveInt"};
3158        case 3059181: /*code*/ return new String[] {"CodeableConcept"};
3159        default: return super.getTypesForProperty(hash, name);
3160        }
3161
3162      }
3163
3164      @Override
3165      public Base addChild(String name) throws FHIRException {
3166        if (name.equals("sequenceLinkId")) {
3167          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
3168        }
3169        else if (name.equals("detailSequenceLinkId")) {
3170          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.detailSequenceLinkId");
3171        }
3172        else if (name.equals("subdetailSequenceLinkId")) {
3173          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.subdetailSequenceLinkId");
3174        }
3175        else if (name.equals("code")) {
3176          this.code = new CodeableConcept();
3177          return this.code;
3178        }
3179        else
3180          return super.addChild(name);
3181      }
3182
3183      public ErrorComponent copy() {
3184        ErrorComponent dst = new ErrorComponent();
3185        copyValues(dst);
3186        dst.sequenceLinkId = sequenceLinkId == null ? null : sequenceLinkId.copy();
3187        dst.detailSequenceLinkId = detailSequenceLinkId == null ? null : detailSequenceLinkId.copy();
3188        dst.subdetailSequenceLinkId = subdetailSequenceLinkId == null ? null : subdetailSequenceLinkId.copy();
3189        dst.code = code == null ? null : code.copy();
3190        return dst;
3191      }
3192
3193      @Override
3194      public boolean equalsDeep(Base other) {
3195        if (!super.equalsDeep(other))
3196          return false;
3197        if (!(other instanceof ErrorComponent))
3198          return false;
3199        ErrorComponent o = (ErrorComponent) other;
3200        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(detailSequenceLinkId, o.detailSequenceLinkId, true)
3201           && compareDeep(subdetailSequenceLinkId, o.subdetailSequenceLinkId, true) && compareDeep(code, o.code, true)
3202          ;
3203      }
3204
3205      @Override
3206      public boolean equalsShallow(Base other) {
3207        if (!super.equalsShallow(other))
3208          return false;
3209        if (!(other instanceof ErrorComponent))
3210          return false;
3211        ErrorComponent o = (ErrorComponent) other;
3212        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(detailSequenceLinkId, o.detailSequenceLinkId, true)
3213           && compareValues(subdetailSequenceLinkId, o.subdetailSequenceLinkId, true);
3214      }
3215
3216      public boolean isEmpty() {
3217        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequenceLinkId, detailSequenceLinkId
3218          , subdetailSequenceLinkId, code);
3219      }
3220
3221  public String fhirType() {
3222    return "ClaimResponse.error";
3223
3224  }
3225
3226  }
3227
3228    @Block()
3229    public static class PaymentComponent extends BackboneElement implements IBaseBackboneElement {
3230        /**
3231         * Whether this represents partial or complete payment of the claim.
3232         */
3233        @Child(name = "type", type = {CodeableConcept.class}, order=1, min=0, max=1, modifier=false, summary=false)
3234        @Description(shortDefinition="Partial or Complete", formalDefinition="Whether this represents partial or complete payment of the claim." )
3235        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/ex-paymenttype")
3236        protected CodeableConcept type;
3237
3238        /**
3239         * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
3240         */
3241        @Child(name = "adjustment", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=false)
3242        @Description(shortDefinition="Payment adjustment for non-Claim issues", formalDefinition="Adjustment to the payment of this transaction which is not related to adjudication of this transaction." )
3243        protected Money adjustment;
3244
3245        /**
3246         * Reason for the payment adjustment.
3247         */
3248        @Child(name = "adjustmentReason", type = {CodeableConcept.class}, order=3, min=0, max=1, modifier=false, summary=false)
3249        @Description(shortDefinition="Explanation for the non-claim adjustment", formalDefinition="Reason for the payment adjustment." )
3250        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payment-adjustment-reason")
3251        protected CodeableConcept adjustmentReason;
3252
3253        /**
3254         * Estimated payment data.
3255         */
3256        @Child(name = "date", type = {DateType.class}, order=4, min=0, max=1, modifier=false, summary=false)
3257        @Description(shortDefinition="Expected data of Payment", formalDefinition="Estimated payment data." )
3258        protected DateType date;
3259
3260        /**
3261         * Payable less any payment adjustment.
3262         */
3263        @Child(name = "amount", type = {Money.class}, order=5, min=0, max=1, modifier=false, summary=false)
3264        @Description(shortDefinition="Payable amount after adjustment", formalDefinition="Payable less any payment adjustment." )
3265        protected Money amount;
3266
3267        /**
3268         * Payment identifier.
3269         */
3270        @Child(name = "identifier", type = {Identifier.class}, order=6, min=0, max=1, modifier=false, summary=false)
3271        @Description(shortDefinition="Identifier of the payment instrument", formalDefinition="Payment identifier." )
3272        protected Identifier identifier;
3273
3274        private static final long serialVersionUID = 1539906026L;
3275
3276    /**
3277     * Constructor
3278     */
3279      public PaymentComponent() {
3280        super();
3281      }
3282
3283        /**
3284         * @return {@link #type} (Whether this represents partial or complete payment of the claim.)
3285         */
3286        public CodeableConcept getType() { 
3287          if (this.type == null)
3288            if (Configuration.errorOnAutoCreate())
3289              throw new Error("Attempt to auto-create PaymentComponent.type");
3290            else if (Configuration.doAutoCreate())
3291              this.type = new CodeableConcept(); // cc
3292          return this.type;
3293        }
3294
3295        public boolean hasType() { 
3296          return this.type != null && !this.type.isEmpty();
3297        }
3298
3299        /**
3300         * @param value {@link #type} (Whether this represents partial or complete payment of the claim.)
3301         */
3302        public PaymentComponent setType(CodeableConcept value) { 
3303          this.type = value;
3304          return this;
3305        }
3306
3307        /**
3308         * @return {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
3309         */
3310        public Money getAdjustment() { 
3311          if (this.adjustment == null)
3312            if (Configuration.errorOnAutoCreate())
3313              throw new Error("Attempt to auto-create PaymentComponent.adjustment");
3314            else if (Configuration.doAutoCreate())
3315              this.adjustment = new Money(); // cc
3316          return this.adjustment;
3317        }
3318
3319        public boolean hasAdjustment() { 
3320          return this.adjustment != null && !this.adjustment.isEmpty();
3321        }
3322
3323        /**
3324         * @param value {@link #adjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
3325         */
3326        public PaymentComponent setAdjustment(Money value) { 
3327          this.adjustment = value;
3328          return this;
3329        }
3330
3331        /**
3332         * @return {@link #adjustmentReason} (Reason for the payment adjustment.)
3333         */
3334        public CodeableConcept getAdjustmentReason() { 
3335          if (this.adjustmentReason == null)
3336            if (Configuration.errorOnAutoCreate())
3337              throw new Error("Attempt to auto-create PaymentComponent.adjustmentReason");
3338            else if (Configuration.doAutoCreate())
3339              this.adjustmentReason = new CodeableConcept(); // cc
3340          return this.adjustmentReason;
3341        }
3342
3343        public boolean hasAdjustmentReason() { 
3344          return this.adjustmentReason != null && !this.adjustmentReason.isEmpty();
3345        }
3346
3347        /**
3348         * @param value {@link #adjustmentReason} (Reason for the payment adjustment.)
3349         */
3350        public PaymentComponent setAdjustmentReason(CodeableConcept value) { 
3351          this.adjustmentReason = value;
3352          return this;
3353        }
3354
3355        /**
3356         * @return {@link #date} (Estimated payment data.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3357         */
3358        public DateType getDateElement() { 
3359          if (this.date == null)
3360            if (Configuration.errorOnAutoCreate())
3361              throw new Error("Attempt to auto-create PaymentComponent.date");
3362            else if (Configuration.doAutoCreate())
3363              this.date = new DateType(); // bb
3364          return this.date;
3365        }
3366
3367        public boolean hasDateElement() { 
3368          return this.date != null && !this.date.isEmpty();
3369        }
3370
3371        public boolean hasDate() { 
3372          return this.date != null && !this.date.isEmpty();
3373        }
3374
3375        /**
3376         * @param value {@link #date} (Estimated payment data.). This is the underlying object with id, value and extensions. The accessor "getDate" gives direct access to the value
3377         */
3378        public PaymentComponent setDateElement(DateType value) { 
3379          this.date = value;
3380          return this;
3381        }
3382
3383        /**
3384         * @return Estimated payment data.
3385         */
3386        public Date getDate() { 
3387          return this.date == null ? null : this.date.getValue();
3388        }
3389
3390        /**
3391         * @param value Estimated payment data.
3392         */
3393        public PaymentComponent setDate(Date value) { 
3394          if (value == null)
3395            this.date = null;
3396          else {
3397            if (this.date == null)
3398              this.date = new DateType();
3399            this.date.setValue(value);
3400          }
3401          return this;
3402        }
3403
3404        /**
3405         * @return {@link #amount} (Payable less any payment adjustment.)
3406         */
3407        public Money getAmount() { 
3408          if (this.amount == null)
3409            if (Configuration.errorOnAutoCreate())
3410              throw new Error("Attempt to auto-create PaymentComponent.amount");
3411            else if (Configuration.doAutoCreate())
3412              this.amount = new Money(); // cc
3413          return this.amount;
3414        }
3415
3416        public boolean hasAmount() { 
3417          return this.amount != null && !this.amount.isEmpty();
3418        }
3419
3420        /**
3421         * @param value {@link #amount} (Payable less any payment adjustment.)
3422         */
3423        public PaymentComponent setAmount(Money value) { 
3424          this.amount = value;
3425          return this;
3426        }
3427
3428        /**
3429         * @return {@link #identifier} (Payment identifier.)
3430         */
3431        public Identifier getIdentifier() { 
3432          if (this.identifier == null)
3433            if (Configuration.errorOnAutoCreate())
3434              throw new Error("Attempt to auto-create PaymentComponent.identifier");
3435            else if (Configuration.doAutoCreate())
3436              this.identifier = new Identifier(); // cc
3437          return this.identifier;
3438        }
3439
3440        public boolean hasIdentifier() { 
3441          return this.identifier != null && !this.identifier.isEmpty();
3442        }
3443
3444        /**
3445         * @param value {@link #identifier} (Payment identifier.)
3446         */
3447        public PaymentComponent setIdentifier(Identifier value) { 
3448          this.identifier = value;
3449          return this;
3450        }
3451
3452        protected void listChildren(List<Property> childrenList) {
3453          super.listChildren(childrenList);
3454          childrenList.add(new Property("type", "CodeableConcept", "Whether this represents partial or complete payment of the claim.", 0, java.lang.Integer.MAX_VALUE, type));
3455          childrenList.add(new Property("adjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, java.lang.Integer.MAX_VALUE, adjustment));
3456          childrenList.add(new Property("adjustmentReason", "CodeableConcept", "Reason for the payment adjustment.", 0, java.lang.Integer.MAX_VALUE, adjustmentReason));
3457          childrenList.add(new Property("date", "date", "Estimated payment data.", 0, java.lang.Integer.MAX_VALUE, date));
3458          childrenList.add(new Property("amount", "Money", "Payable less any payment adjustment.", 0, java.lang.Integer.MAX_VALUE, amount));
3459          childrenList.add(new Property("identifier", "Identifier", "Payment identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
3460        }
3461
3462      @Override
3463      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3464        switch (hash) {
3465        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3466        case 1977085293: /*adjustment*/ return this.adjustment == null ? new Base[0] : new Base[] {this.adjustment}; // Money
3467        case -1255938543: /*adjustmentReason*/ return this.adjustmentReason == null ? new Base[0] : new Base[] {this.adjustmentReason}; // CodeableConcept
3468        case 3076014: /*date*/ return this.date == null ? new Base[0] : new Base[] {this.date}; // DateType
3469        case -1413853096: /*amount*/ return this.amount == null ? new Base[0] : new Base[] {this.amount}; // Money
3470        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : new Base[] {this.identifier}; // Identifier
3471        default: return super.getProperty(hash, name, checkValid);
3472        }
3473
3474      }
3475
3476      @Override
3477      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3478        switch (hash) {
3479        case 3575610: // type
3480          this.type = castToCodeableConcept(value); // CodeableConcept
3481          return value;
3482        case 1977085293: // adjustment
3483          this.adjustment = castToMoney(value); // Money
3484          return value;
3485        case -1255938543: // adjustmentReason
3486          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
3487          return value;
3488        case 3076014: // date
3489          this.date = castToDate(value); // DateType
3490          return value;
3491        case -1413853096: // amount
3492          this.amount = castToMoney(value); // Money
3493          return value;
3494        case -1618432855: // identifier
3495          this.identifier = castToIdentifier(value); // Identifier
3496          return value;
3497        default: return super.setProperty(hash, name, value);
3498        }
3499
3500      }
3501
3502      @Override
3503      public Base setProperty(String name, Base value) throws FHIRException {
3504        if (name.equals("type")) {
3505          this.type = castToCodeableConcept(value); // CodeableConcept
3506        } else if (name.equals("adjustment")) {
3507          this.adjustment = castToMoney(value); // Money
3508        } else if (name.equals("adjustmentReason")) {
3509          this.adjustmentReason = castToCodeableConcept(value); // CodeableConcept
3510        } else if (name.equals("date")) {
3511          this.date = castToDate(value); // DateType
3512        } else if (name.equals("amount")) {
3513          this.amount = castToMoney(value); // Money
3514        } else if (name.equals("identifier")) {
3515          this.identifier = castToIdentifier(value); // Identifier
3516        } else
3517          return super.setProperty(name, value);
3518        return value;
3519      }
3520
3521      @Override
3522      public Base makeProperty(int hash, String name) throws FHIRException {
3523        switch (hash) {
3524        case 3575610:  return getType(); 
3525        case 1977085293:  return getAdjustment(); 
3526        case -1255938543:  return getAdjustmentReason(); 
3527        case 3076014:  return getDateElement();
3528        case -1413853096:  return getAmount(); 
3529        case -1618432855:  return getIdentifier(); 
3530        default: return super.makeProperty(hash, name);
3531        }
3532
3533      }
3534
3535      @Override
3536      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3537        switch (hash) {
3538        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3539        case 1977085293: /*adjustment*/ return new String[] {"Money"};
3540        case -1255938543: /*adjustmentReason*/ return new String[] {"CodeableConcept"};
3541        case 3076014: /*date*/ return new String[] {"date"};
3542        case -1413853096: /*amount*/ return new String[] {"Money"};
3543        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
3544        default: return super.getTypesForProperty(hash, name);
3545        }
3546
3547      }
3548
3549      @Override
3550      public Base addChild(String name) throws FHIRException {
3551        if (name.equals("type")) {
3552          this.type = new CodeableConcept();
3553          return this.type;
3554        }
3555        else if (name.equals("adjustment")) {
3556          this.adjustment = new Money();
3557          return this.adjustment;
3558        }
3559        else if (name.equals("adjustmentReason")) {
3560          this.adjustmentReason = new CodeableConcept();
3561          return this.adjustmentReason;
3562        }
3563        else if (name.equals("date")) {
3564          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.date");
3565        }
3566        else if (name.equals("amount")) {
3567          this.amount = new Money();
3568          return this.amount;
3569        }
3570        else if (name.equals("identifier")) {
3571          this.identifier = new Identifier();
3572          return this.identifier;
3573        }
3574        else
3575          return super.addChild(name);
3576      }
3577
3578      public PaymentComponent copy() {
3579        PaymentComponent dst = new PaymentComponent();
3580        copyValues(dst);
3581        dst.type = type == null ? null : type.copy();
3582        dst.adjustment = adjustment == null ? null : adjustment.copy();
3583        dst.adjustmentReason = adjustmentReason == null ? null : adjustmentReason.copy();
3584        dst.date = date == null ? null : date.copy();
3585        dst.amount = amount == null ? null : amount.copy();
3586        dst.identifier = identifier == null ? null : identifier.copy();
3587        return dst;
3588      }
3589
3590      @Override
3591      public boolean equalsDeep(Base other) {
3592        if (!super.equalsDeep(other))
3593          return false;
3594        if (!(other instanceof PaymentComponent))
3595          return false;
3596        PaymentComponent o = (PaymentComponent) other;
3597        return compareDeep(type, o.type, true) && compareDeep(adjustment, o.adjustment, true) && compareDeep(adjustmentReason, o.adjustmentReason, true)
3598           && compareDeep(date, o.date, true) && compareDeep(amount, o.amount, true) && compareDeep(identifier, o.identifier, true)
3599          ;
3600      }
3601
3602      @Override
3603      public boolean equalsShallow(Base other) {
3604        if (!super.equalsShallow(other))
3605          return false;
3606        if (!(other instanceof PaymentComponent))
3607          return false;
3608        PaymentComponent o = (PaymentComponent) other;
3609        return compareValues(date, o.date, true);
3610      }
3611
3612      public boolean isEmpty() {
3613        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(type, adjustment, adjustmentReason
3614          , date, amount, identifier);
3615      }
3616
3617  public String fhirType() {
3618    return "ClaimResponse.payment";
3619
3620  }
3621
3622  }
3623
3624    @Block()
3625    public static class NoteComponent extends BackboneElement implements IBaseBackboneElement {
3626        /**
3627         * An integer associated with each note which may be referred to from each service line item.
3628         */
3629        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=false)
3630        @Description(shortDefinition="Sequence Number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
3631        protected PositiveIntType number;
3632
3633        /**
3634         * The note purpose: Print/Display.
3635         */
3636        @Child(name = "type", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false)
3637        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
3638        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/note-type")
3639        protected CodeableConcept type;
3640
3641        /**
3642         * The note text.
3643         */
3644        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=false)
3645        @Description(shortDefinition="Note explanatory text", formalDefinition="The note text." )
3646        protected StringType text;
3647
3648        /**
3649         * The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.
3650         */
3651        @Child(name = "language", type = {CodeableConcept.class}, order=4, min=0, max=1, modifier=false, summary=false)
3652        @Description(shortDefinition="Language if different from the resource", formalDefinition="The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English." )
3653        @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/languages")
3654        protected CodeableConcept language;
3655
3656        private static final long serialVersionUID = -944255449L;
3657
3658    /**
3659     * Constructor
3660     */
3661      public NoteComponent() {
3662        super();
3663      }
3664
3665        /**
3666         * @return {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
3667         */
3668        public PositiveIntType getNumberElement() { 
3669          if (this.number == null)
3670            if (Configuration.errorOnAutoCreate())
3671              throw new Error("Attempt to auto-create NoteComponent.number");
3672            else if (Configuration.doAutoCreate())
3673              this.number = new PositiveIntType(); // bb
3674          return this.number;
3675        }
3676
3677        public boolean hasNumberElement() { 
3678          return this.number != null && !this.number.isEmpty();
3679        }
3680
3681        public boolean hasNumber() { 
3682          return this.number != null && !this.number.isEmpty();
3683        }
3684
3685        /**
3686         * @param value {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
3687         */
3688        public NoteComponent setNumberElement(PositiveIntType value) { 
3689          this.number = value;
3690          return this;
3691        }
3692
3693        /**
3694         * @return An integer associated with each note which may be referred to from each service line item.
3695         */
3696        public int getNumber() { 
3697          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
3698        }
3699
3700        /**
3701         * @param value An integer associated with each note which may be referred to from each service line item.
3702         */
3703        public NoteComponent setNumber(int value) { 
3704            if (this.number == null)
3705              this.number = new PositiveIntType();
3706            this.number.setValue(value);
3707          return this;
3708        }
3709
3710        /**
3711         * @return {@link #type} (The note purpose: Print/Display.)
3712         */
3713        public CodeableConcept getType() { 
3714          if (this.type == null)
3715            if (Configuration.errorOnAutoCreate())
3716              throw new Error("Attempt to auto-create NoteComponent.type");
3717            else if (Configuration.doAutoCreate())
3718              this.type = new CodeableConcept(); // cc
3719          return this.type;
3720        }
3721
3722        public boolean hasType() { 
3723          return this.type != null && !this.type.isEmpty();
3724        }
3725
3726        /**
3727         * @param value {@link #type} (The note purpose: Print/Display.)
3728         */
3729        public NoteComponent setType(CodeableConcept value) { 
3730          this.type = value;
3731          return this;
3732        }
3733
3734        /**
3735         * @return {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
3736         */
3737        public StringType getTextElement() { 
3738          if (this.text == null)
3739            if (Configuration.errorOnAutoCreate())
3740              throw new Error("Attempt to auto-create NoteComponent.text");
3741            else if (Configuration.doAutoCreate())
3742              this.text = new StringType(); // bb
3743          return this.text;
3744        }
3745
3746        public boolean hasTextElement() { 
3747          return this.text != null && !this.text.isEmpty();
3748        }
3749
3750        public boolean hasText() { 
3751          return this.text != null && !this.text.isEmpty();
3752        }
3753
3754        /**
3755         * @param value {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
3756         */
3757        public NoteComponent setTextElement(StringType value) { 
3758          this.text = value;
3759          return this;
3760        }
3761
3762        /**
3763         * @return The note text.
3764         */
3765        public String getText() { 
3766          return this.text == null ? null : this.text.getValue();
3767        }
3768
3769        /**
3770         * @param value The note text.
3771         */
3772        public NoteComponent setText(String value) { 
3773          if (Utilities.noString(value))
3774            this.text = null;
3775          else {
3776            if (this.text == null)
3777              this.text = new StringType();
3778            this.text.setValue(value);
3779          }
3780          return this;
3781        }
3782
3783        /**
3784         * @return {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.)
3785         */
3786        public CodeableConcept getLanguage() { 
3787          if (this.language == null)
3788            if (Configuration.errorOnAutoCreate())
3789              throw new Error("Attempt to auto-create NoteComponent.language");
3790            else if (Configuration.doAutoCreate())
3791              this.language = new CodeableConcept(); // cc
3792          return this.language;
3793        }
3794
3795        public boolean hasLanguage() { 
3796          return this.language != null && !this.language.isEmpty();
3797        }
3798
3799        /**
3800         * @param value {@link #language} (The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. "en" for English, or "en-US" for American English versus "en-EN" for England English.)
3801         */
3802        public NoteComponent setLanguage(CodeableConcept value) { 
3803          this.language = value;
3804          return this;
3805        }
3806
3807        protected void listChildren(List<Property> childrenList) {
3808          super.listChildren(childrenList);
3809          childrenList.add(new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, java.lang.Integer.MAX_VALUE, number));
3810          childrenList.add(new Property("type", "CodeableConcept", "The note purpose: Print/Display.", 0, java.lang.Integer.MAX_VALUE, type));
3811          childrenList.add(new Property("text", "string", "The note text.", 0, java.lang.Integer.MAX_VALUE, text));
3812          childrenList.add(new Property("language", "CodeableConcept", "The ISO-639-1 alpha 2 code in lower case for the language, optionally followed by a hyphen and the ISO-3166-1 alpha 2 code for the region in upper case; e.g. \"en\" for English, or \"en-US\" for American English versus \"en-EN\" for England English.", 0, java.lang.Integer.MAX_VALUE, language));
3813        }
3814
3815      @Override
3816      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
3817        switch (hash) {
3818        case -1034364087: /*number*/ return this.number == null ? new Base[0] : new Base[] {this.number}; // PositiveIntType
3819        case 3575610: /*type*/ return this.type == null ? new Base[0] : new Base[] {this.type}; // CodeableConcept
3820        case 3556653: /*text*/ return this.text == null ? new Base[0] : new Base[] {this.text}; // StringType
3821        case -1613589672: /*language*/ return this.language == null ? new Base[0] : new Base[] {this.language}; // CodeableConcept
3822        default: return super.getProperty(hash, name, checkValid);
3823        }
3824
3825      }
3826
3827      @Override
3828      public Base setProperty(int hash, String name, Base value) throws FHIRException {
3829        switch (hash) {
3830        case -1034364087: // number
3831          this.number = castToPositiveInt(value); // PositiveIntType
3832          return value;
3833        case 3575610: // type
3834          this.type = castToCodeableConcept(value); // CodeableConcept
3835          return value;
3836        case 3556653: // text
3837          this.text = castToString(value); // StringType
3838          return value;
3839        case -1613589672: // language
3840          this.language = castToCodeableConcept(value); // CodeableConcept
3841          return value;
3842        default: return super.setProperty(hash, name, value);
3843        }
3844
3845      }
3846
3847      @Override
3848      public Base setProperty(String name, Base value) throws FHIRException {
3849        if (name.equals("number")) {
3850          this.number = castToPositiveInt(value); // PositiveIntType
3851        } else if (name.equals("type")) {
3852          this.type = castToCodeableConcept(value); // CodeableConcept
3853        } else if (name.equals("text")) {
3854          this.text = castToString(value); // StringType
3855        } else if (name.equals("language")) {
3856          this.language = castToCodeableConcept(value); // CodeableConcept
3857        } else
3858          return super.setProperty(name, value);
3859        return value;
3860      }
3861
3862      @Override
3863      public Base makeProperty(int hash, String name) throws FHIRException {
3864        switch (hash) {
3865        case -1034364087:  return getNumberElement();
3866        case 3575610:  return getType(); 
3867        case 3556653:  return getTextElement();
3868        case -1613589672:  return getLanguage(); 
3869        default: return super.makeProperty(hash, name);
3870        }
3871
3872      }
3873
3874      @Override
3875      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
3876        switch (hash) {
3877        case -1034364087: /*number*/ return new String[] {"positiveInt"};
3878        case 3575610: /*type*/ return new String[] {"CodeableConcept"};
3879        case 3556653: /*text*/ return new String[] {"string"};
3880        case -1613589672: /*language*/ return new String[] {"CodeableConcept"};
3881        default: return super.getTypesForProperty(hash, name);
3882        }
3883
3884      }
3885
3886      @Override
3887      public Base addChild(String name) throws FHIRException {
3888        if (name.equals("number")) {
3889          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.number");
3890        }
3891        else if (name.equals("type")) {
3892          this.type = new CodeableConcept();
3893          return this.type;
3894        }
3895        else if (name.equals("text")) {
3896          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.text");
3897        }
3898        else if (name.equals("language")) {
3899          this.language = new CodeableConcept();
3900          return this.language;
3901        }
3902        else
3903          return super.addChild(name);
3904      }
3905
3906      public NoteComponent copy() {
3907        NoteComponent dst = new NoteComponent();
3908        copyValues(dst);
3909        dst.number = number == null ? null : number.copy();
3910        dst.type = type == null ? null : type.copy();
3911        dst.text = text == null ? null : text.copy();
3912        dst.language = language == null ? null : language.copy();
3913        return dst;
3914      }
3915
3916      @Override
3917      public boolean equalsDeep(Base other) {
3918        if (!super.equalsDeep(other))
3919          return false;
3920        if (!(other instanceof NoteComponent))
3921          return false;
3922        NoteComponent o = (NoteComponent) other;
3923        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
3924           && compareDeep(language, o.language, true);
3925      }
3926
3927      @Override
3928      public boolean equalsShallow(Base other) {
3929        if (!super.equalsShallow(other))
3930          return false;
3931        if (!(other instanceof NoteComponent))
3932          return false;
3933        NoteComponent o = (NoteComponent) other;
3934        return compareValues(number, o.number, true) && compareValues(text, o.text, true);
3935      }
3936
3937      public boolean isEmpty() {
3938        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(number, type, text, language
3939          );
3940      }
3941
3942  public String fhirType() {
3943    return "ClaimResponse.processNote";
3944
3945  }
3946
3947  }
3948
3949    @Block()
3950    public static class InsuranceComponent extends BackboneElement implements IBaseBackboneElement {
3951        /**
3952         * A service line item.
3953         */
3954        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=false)
3955        @Description(shortDefinition="Service instance identifier", formalDefinition="A service line item." )
3956        protected PositiveIntType sequence;
3957
3958        /**
3959         * The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.
3960         */
3961        @Child(name = "focal", type = {BooleanType.class}, order=2, min=1, max=1, modifier=false, summary=false)
3962        @Description(shortDefinition="Is the focal Coverage", formalDefinition="The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated." )
3963        protected BooleanType focal;
3964
3965        /**
3966         * Reference to the program or plan identification, underwriter or payor.
3967         */
3968        @Child(name = "coverage", type = {Coverage.class}, order=3, min=1, max=1, modifier=false, summary=false)
3969        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
3970        protected Reference coverage;
3971
3972        /**
3973         * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
3974         */
3975        protected Coverage coverageTarget;
3976
3977        /**
3978         * The contract number of a business agreement which describes the terms and conditions.
3979         */
3980        @Child(name = "businessArrangement", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=false)
3981        @Description(shortDefinition="Business agreement", formalDefinition="The contract number of a business agreement which describes the terms and conditions." )
3982        protected StringType businessArrangement;
3983
3984        /**
3985         * A list of references from the Insurer to which these services pertain.
3986         */
3987        @Child(name = "preAuthRef", type = {StringType.class}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
3988        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
3989        protected List<StringType> preAuthRef;
3990
3991        /**
3992         * The Coverages adjudication details.
3993         */
3994        @Child(name = "claimResponse", type = {ClaimResponse.class}, order=6, min=0, max=1, modifier=false, summary=false)
3995        @Description(shortDefinition="Adjudication results", formalDefinition="The Coverages adjudication details." )
3996        protected Reference claimResponse;
3997
3998        /**
3999         * The actual object that is the target of the reference (The Coverages adjudication details.)
4000         */
4001        protected ClaimResponse claimResponseTarget;
4002
4003        private static final long serialVersionUID = -1216535489L;
4004
4005    /**
4006     * Constructor
4007     */
4008      public InsuranceComponent() {
4009        super();
4010      }
4011
4012    /**
4013     * Constructor
4014     */
4015      public InsuranceComponent(PositiveIntType sequence, BooleanType focal, Reference coverage) {
4016        super();
4017        this.sequence = sequence;
4018        this.focal = focal;
4019        this.coverage = coverage;
4020      }
4021
4022        /**
4023         * @return {@link #sequence} (A service line item.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
4024         */
4025        public PositiveIntType getSequenceElement() { 
4026          if (this.sequence == null)
4027            if (Configuration.errorOnAutoCreate())
4028              throw new Error("Attempt to auto-create InsuranceComponent.sequence");
4029            else if (Configuration.doAutoCreate())
4030              this.sequence = new PositiveIntType(); // bb
4031          return this.sequence;
4032        }
4033
4034        public boolean hasSequenceElement() { 
4035          return this.sequence != null && !this.sequence.isEmpty();
4036        }
4037
4038        public boolean hasSequence() { 
4039          return this.sequence != null && !this.sequence.isEmpty();
4040        }
4041
4042        /**
4043         * @param value {@link #sequence} (A service line item.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
4044         */
4045        public InsuranceComponent setSequenceElement(PositiveIntType value) { 
4046          this.sequence = value;
4047          return this;
4048        }
4049
4050        /**
4051         * @return A service line item.
4052         */
4053        public int getSequence() { 
4054          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
4055        }
4056
4057        /**
4058         * @param value A service line item.
4059         */
4060        public InsuranceComponent setSequence(int value) { 
4061            if (this.sequence == null)
4062              this.sequence = new PositiveIntType();
4063            this.sequence.setValue(value);
4064          return this;
4065        }
4066
4067        /**
4068         * @return {@link #focal} (The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
4069         */
4070        public BooleanType getFocalElement() { 
4071          if (this.focal == null)
4072            if (Configuration.errorOnAutoCreate())
4073              throw new Error("Attempt to auto-create InsuranceComponent.focal");
4074            else if (Configuration.doAutoCreate())
4075              this.focal = new BooleanType(); // bb
4076          return this.focal;
4077        }
4078
4079        public boolean hasFocalElement() { 
4080          return this.focal != null && !this.focal.isEmpty();
4081        }
4082
4083        public boolean hasFocal() { 
4084          return this.focal != null && !this.focal.isEmpty();
4085        }
4086
4087        /**
4088         * @param value {@link #focal} (The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
4089         */
4090        public InsuranceComponent setFocalElement(BooleanType value) { 
4091          this.focal = value;
4092          return this;
4093        }
4094
4095        /**
4096         * @return The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.
4097         */
4098        public boolean getFocal() { 
4099          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
4100        }
4101
4102        /**
4103         * @param value The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.
4104         */
4105        public InsuranceComponent setFocal(boolean value) { 
4106            if (this.focal == null)
4107              this.focal = new BooleanType();
4108            this.focal.setValue(value);
4109          return this;
4110        }
4111
4112        /**
4113         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
4114         */
4115        public Reference getCoverage() { 
4116          if (this.coverage == null)
4117            if (Configuration.errorOnAutoCreate())
4118              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
4119            else if (Configuration.doAutoCreate())
4120              this.coverage = new Reference(); // cc
4121          return this.coverage;
4122        }
4123
4124        public boolean hasCoverage() { 
4125          return this.coverage != null && !this.coverage.isEmpty();
4126        }
4127
4128        /**
4129         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
4130         */
4131        public InsuranceComponent setCoverage(Reference value) { 
4132          this.coverage = value;
4133          return this;
4134        }
4135
4136        /**
4137         * @return {@link #coverage} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
4138         */
4139        public Coverage getCoverageTarget() { 
4140          if (this.coverageTarget == null)
4141            if (Configuration.errorOnAutoCreate())
4142              throw new Error("Attempt to auto-create InsuranceComponent.coverage");
4143            else if (Configuration.doAutoCreate())
4144              this.coverageTarget = new Coverage(); // aa
4145          return this.coverageTarget;
4146        }
4147
4148        /**
4149         * @param value {@link #coverage} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
4150         */
4151        public InsuranceComponent setCoverageTarget(Coverage value) { 
4152          this.coverageTarget = value;
4153          return this;
4154        }
4155
4156        /**
4157         * @return {@link #businessArrangement} (The contract number of a business agreement which describes the terms and conditions.). This is the underlying object with id, value and extensions. The accessor "getBusinessArrangement" gives direct access to the value
4158         */
4159        public StringType getBusinessArrangementElement() { 
4160          if (this.businessArrangement == null)
4161            if (Configuration.errorOnAutoCreate())
4162              throw new Error("Attempt to auto-create InsuranceComponent.businessArrangement");
4163            else if (Configuration.doAutoCreate())
4164              this.businessArrangement = new StringType(); // bb
4165          return this.businessArrangement;
4166        }
4167
4168        public boolean hasBusinessArrangementElement() { 
4169          return this.businessArrangement != null && !this.businessArrangement.isEmpty();
4170        }
4171
4172        public boolean hasBusinessArrangement() { 
4173          return this.businessArrangement != null && !this.businessArrangement.isEmpty();
4174        }
4175
4176        /**
4177         * @param value {@link #businessArrangement} (The contract number of a business agreement which describes the terms and conditions.). This is the underlying object with id, value and extensions. The accessor "getBusinessArrangement" gives direct access to the value
4178         */
4179        public InsuranceComponent setBusinessArrangementElement(StringType value) { 
4180          this.businessArrangement = value;
4181          return this;
4182        }
4183
4184        /**
4185         * @return The contract number of a business agreement which describes the terms and conditions.
4186         */
4187        public String getBusinessArrangement() { 
4188          return this.businessArrangement == null ? null : this.businessArrangement.getValue();
4189        }
4190
4191        /**
4192         * @param value The contract number of a business agreement which describes the terms and conditions.
4193         */
4194        public InsuranceComponent setBusinessArrangement(String value) { 
4195          if (Utilities.noString(value))
4196            this.businessArrangement = null;
4197          else {
4198            if (this.businessArrangement == null)
4199              this.businessArrangement = new StringType();
4200            this.businessArrangement.setValue(value);
4201          }
4202          return this;
4203        }
4204
4205        /**
4206         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
4207         */
4208        public List<StringType> getPreAuthRef() { 
4209          if (this.preAuthRef == null)
4210            this.preAuthRef = new ArrayList<StringType>();
4211          return this.preAuthRef;
4212        }
4213
4214        /**
4215         * @return Returns a reference to <code>this</code> for easy method chaining
4216         */
4217        public InsuranceComponent setPreAuthRef(List<StringType> thePreAuthRef) { 
4218          this.preAuthRef = thePreAuthRef;
4219          return this;
4220        }
4221
4222        public boolean hasPreAuthRef() { 
4223          if (this.preAuthRef == null)
4224            return false;
4225          for (StringType item : this.preAuthRef)
4226            if (!item.isEmpty())
4227              return true;
4228          return false;
4229        }
4230
4231        /**
4232         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
4233         */
4234        public StringType addPreAuthRefElement() {//2 
4235          StringType t = new StringType();
4236          if (this.preAuthRef == null)
4237            this.preAuthRef = new ArrayList<StringType>();
4238          this.preAuthRef.add(t);
4239          return t;
4240        }
4241
4242        /**
4243         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
4244         */
4245        public InsuranceComponent addPreAuthRef(String value) { //1
4246          StringType t = new StringType();
4247          t.setValue(value);
4248          if (this.preAuthRef == null)
4249            this.preAuthRef = new ArrayList<StringType>();
4250          this.preAuthRef.add(t);
4251          return this;
4252        }
4253
4254        /**
4255         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
4256         */
4257        public boolean hasPreAuthRef(String value) { 
4258          if (this.preAuthRef == null)
4259            return false;
4260          for (StringType v : this.preAuthRef)
4261            if (v.equals(value)) // string
4262              return true;
4263          return false;
4264        }
4265
4266        /**
4267         * @return {@link #claimResponse} (The Coverages adjudication details.)
4268         */
4269        public Reference getClaimResponse() { 
4270          if (this.claimResponse == null)
4271            if (Configuration.errorOnAutoCreate())
4272              throw new Error("Attempt to auto-create InsuranceComponent.claimResponse");
4273            else if (Configuration.doAutoCreate())
4274              this.claimResponse = new Reference(); // cc
4275          return this.claimResponse;
4276        }
4277
4278        public boolean hasClaimResponse() { 
4279          return this.claimResponse != null && !this.claimResponse.isEmpty();
4280        }
4281
4282        /**
4283         * @param value {@link #claimResponse} (The Coverages adjudication details.)
4284         */
4285        public InsuranceComponent setClaimResponse(Reference value) { 
4286          this.claimResponse = value;
4287          return this;
4288        }
4289
4290        /**
4291         * @return {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Coverages adjudication details.)
4292         */
4293        public ClaimResponse getClaimResponseTarget() { 
4294          if (this.claimResponseTarget == null)
4295            if (Configuration.errorOnAutoCreate())
4296              throw new Error("Attempt to auto-create InsuranceComponent.claimResponse");
4297            else if (Configuration.doAutoCreate())
4298              this.claimResponseTarget = new ClaimResponse(); // aa
4299          return this.claimResponseTarget;
4300        }
4301
4302        /**
4303         * @param value {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Coverages adjudication details.)
4304         */
4305        public InsuranceComponent setClaimResponseTarget(ClaimResponse value) { 
4306          this.claimResponseTarget = value;
4307          return this;
4308        }
4309
4310        protected void listChildren(List<Property> childrenList) {
4311          super.listChildren(childrenList);
4312          childrenList.add(new Property("sequence", "positiveInt", "A service line item.", 0, java.lang.Integer.MAX_VALUE, sequence));
4313          childrenList.add(new Property("focal", "boolean", "The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.", 0, java.lang.Integer.MAX_VALUE, focal));
4314          childrenList.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, coverage));
4315          childrenList.add(new Property("businessArrangement", "string", "The contract number of a business agreement which describes the terms and conditions.", 0, java.lang.Integer.MAX_VALUE, businessArrangement));
4316          childrenList.add(new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
4317          childrenList.add(new Property("claimResponse", "Reference(ClaimResponse)", "The Coverages adjudication details.", 0, java.lang.Integer.MAX_VALUE, claimResponse));
4318        }
4319
4320      @Override
4321      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
4322        switch (hash) {
4323        case 1349547969: /*sequence*/ return this.sequence == null ? new Base[0] : new Base[] {this.sequence}; // PositiveIntType
4324        case 97604197: /*focal*/ return this.focal == null ? new Base[0] : new Base[] {this.focal}; // BooleanType
4325        case -351767064: /*coverage*/ return this.coverage == null ? new Base[0] : new Base[] {this.coverage}; // Reference
4326        case 259920682: /*businessArrangement*/ return this.businessArrangement == null ? new Base[0] : new Base[] {this.businessArrangement}; // StringType
4327        case 522246568: /*preAuthRef*/ return this.preAuthRef == null ? new Base[0] : this.preAuthRef.toArray(new Base[this.preAuthRef.size()]); // StringType
4328        case 689513629: /*claimResponse*/ return this.claimResponse == null ? new Base[0] : new Base[] {this.claimResponse}; // Reference
4329        default: return super.getProperty(hash, name, checkValid);
4330        }
4331
4332      }
4333
4334      @Override
4335      public Base setProperty(int hash, String name, Base value) throws FHIRException {
4336        switch (hash) {
4337        case 1349547969: // sequence
4338          this.sequence = castToPositiveInt(value); // PositiveIntType
4339          return value;
4340        case 97604197: // focal
4341          this.focal = castToBoolean(value); // BooleanType
4342          return value;
4343        case -351767064: // coverage
4344          this.coverage = castToReference(value); // Reference
4345          return value;
4346        case 259920682: // businessArrangement
4347          this.businessArrangement = castToString(value); // StringType
4348          return value;
4349        case 522246568: // preAuthRef
4350          this.getPreAuthRef().add(castToString(value)); // StringType
4351          return value;
4352        case 689513629: // claimResponse
4353          this.claimResponse = castToReference(value); // Reference
4354          return value;
4355        default: return super.setProperty(hash, name, value);
4356        }
4357
4358      }
4359
4360      @Override
4361      public Base setProperty(String name, Base value) throws FHIRException {
4362        if (name.equals("sequence")) {
4363          this.sequence = castToPositiveInt(value); // PositiveIntType
4364        } else if (name.equals("focal")) {
4365          this.focal = castToBoolean(value); // BooleanType
4366        } else if (name.equals("coverage")) {
4367          this.coverage = castToReference(value); // Reference
4368        } else if (name.equals("businessArrangement")) {
4369          this.businessArrangement = castToString(value); // StringType
4370        } else if (name.equals("preAuthRef")) {
4371          this.getPreAuthRef().add(castToString(value));
4372        } else if (name.equals("claimResponse")) {
4373          this.claimResponse = castToReference(value); // Reference
4374        } else
4375          return super.setProperty(name, value);
4376        return value;
4377      }
4378
4379      @Override
4380      public Base makeProperty(int hash, String name) throws FHIRException {
4381        switch (hash) {
4382        case 1349547969:  return getSequenceElement();
4383        case 97604197:  return getFocalElement();
4384        case -351767064:  return getCoverage(); 
4385        case 259920682:  return getBusinessArrangementElement();
4386        case 522246568:  return addPreAuthRefElement();
4387        case 689513629:  return getClaimResponse(); 
4388        default: return super.makeProperty(hash, name);
4389        }
4390
4391      }
4392
4393      @Override
4394      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
4395        switch (hash) {
4396        case 1349547969: /*sequence*/ return new String[] {"positiveInt"};
4397        case 97604197: /*focal*/ return new String[] {"boolean"};
4398        case -351767064: /*coverage*/ return new String[] {"Reference"};
4399        case 259920682: /*businessArrangement*/ return new String[] {"string"};
4400        case 522246568: /*preAuthRef*/ return new String[] {"string"};
4401        case 689513629: /*claimResponse*/ return new String[] {"Reference"};
4402        default: return super.getTypesForProperty(hash, name);
4403        }
4404
4405      }
4406
4407      @Override
4408      public Base addChild(String name) throws FHIRException {
4409        if (name.equals("sequence")) {
4410          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequence");
4411        }
4412        else if (name.equals("focal")) {
4413          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.focal");
4414        }
4415        else if (name.equals("coverage")) {
4416          this.coverage = new Reference();
4417          return this.coverage;
4418        }
4419        else if (name.equals("businessArrangement")) {
4420          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.businessArrangement");
4421        }
4422        else if (name.equals("preAuthRef")) {
4423          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.preAuthRef");
4424        }
4425        else if (name.equals("claimResponse")) {
4426          this.claimResponse = new Reference();
4427          return this.claimResponse;
4428        }
4429        else
4430          return super.addChild(name);
4431      }
4432
4433      public InsuranceComponent copy() {
4434        InsuranceComponent dst = new InsuranceComponent();
4435        copyValues(dst);
4436        dst.sequence = sequence == null ? null : sequence.copy();
4437        dst.focal = focal == null ? null : focal.copy();
4438        dst.coverage = coverage == null ? null : coverage.copy();
4439        dst.businessArrangement = businessArrangement == null ? null : businessArrangement.copy();
4440        if (preAuthRef != null) {
4441          dst.preAuthRef = new ArrayList<StringType>();
4442          for (StringType i : preAuthRef)
4443            dst.preAuthRef.add(i.copy());
4444        };
4445        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
4446        return dst;
4447      }
4448
4449      @Override
4450      public boolean equalsDeep(Base other) {
4451        if (!super.equalsDeep(other))
4452          return false;
4453        if (!(other instanceof InsuranceComponent))
4454          return false;
4455        InsuranceComponent o = (InsuranceComponent) other;
4456        return compareDeep(sequence, o.sequence, true) && compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true)
4457           && compareDeep(businessArrangement, o.businessArrangement, true) && compareDeep(preAuthRef, o.preAuthRef, true)
4458           && compareDeep(claimResponse, o.claimResponse, true);
4459      }
4460
4461      @Override
4462      public boolean equalsShallow(Base other) {
4463        if (!super.equalsShallow(other))
4464          return false;
4465        if (!(other instanceof InsuranceComponent))
4466          return false;
4467        InsuranceComponent o = (InsuranceComponent) other;
4468        return compareValues(sequence, o.sequence, true) && compareValues(focal, o.focal, true) && compareValues(businessArrangement, o.businessArrangement, true)
4469           && compareValues(preAuthRef, o.preAuthRef, true);
4470      }
4471
4472      public boolean isEmpty() {
4473        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(sequence, focal, coverage
4474          , businessArrangement, preAuthRef, claimResponse);
4475      }
4476
4477  public String fhirType() {
4478    return "ClaimResponse.insurance";
4479
4480  }
4481
4482  }
4483
4484    /**
4485     * The Response business identifier.
4486     */
4487    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4488    @Description(shortDefinition="Response  number", formalDefinition="The Response business identifier." )
4489    protected List<Identifier> identifier;
4490
4491    /**
4492     * The status of the resource instance.
4493     */
4494    @Child(name = "status", type = {CodeType.class}, order=1, min=0, max=1, modifier=true, summary=true)
4495    @Description(shortDefinition="active | cancelled | draft | entered-in-error", formalDefinition="The status of the resource instance." )
4496    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fm-status")
4497    protected Enumeration<ClaimResponseStatus> status;
4498
4499    /**
4500     * Patient Resource.
4501     */
4502    @Child(name = "patient", type = {Patient.class}, order=2, min=0, max=1, modifier=false, summary=false)
4503    @Description(shortDefinition="The subject of the Products and Services", formalDefinition="Patient Resource." )
4504    protected Reference patient;
4505
4506    /**
4507     * The actual object that is the target of the reference (Patient Resource.)
4508     */
4509    protected Patient patientTarget;
4510
4511    /**
4512     * The date when the enclosed suite of services were performed or completed.
4513     */
4514    @Child(name = "created", type = {DateTimeType.class}, order=3, min=0, max=1, modifier=false, summary=false)
4515    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
4516    protected DateTimeType created;
4517
4518    /**
4519     * The Insurer who produced this adjudicated response.
4520     */
4521    @Child(name = "insurer", type = {Organization.class}, order=4, min=0, max=1, modifier=false, summary=false)
4522    @Description(shortDefinition="Insurance issuing organization", formalDefinition="The Insurer who produced this adjudicated response." )
4523    protected Reference insurer;
4524
4525    /**
4526     * The actual object that is the target of the reference (The Insurer who produced this adjudicated response.)
4527     */
4528    protected Organization insurerTarget;
4529
4530    /**
4531     * The practitioner who is responsible for the services rendered to the patient.
4532     */
4533    @Child(name = "requestProvider", type = {Practitioner.class}, order=5, min=0, max=1, modifier=false, summary=false)
4534    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
4535    protected Reference requestProvider;
4536
4537    /**
4538     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
4539     */
4540    protected Practitioner requestProviderTarget;
4541
4542    /**
4543     * The organization which is responsible for the services rendered to the patient.
4544     */
4545    @Child(name = "requestOrganization", type = {Organization.class}, order=6, min=0, max=1, modifier=false, summary=false)
4546    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
4547    protected Reference requestOrganization;
4548
4549    /**
4550     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
4551     */
4552    protected Organization requestOrganizationTarget;
4553
4554    /**
4555     * Original request resource referrence.
4556     */
4557    @Child(name = "request", type = {Claim.class}, order=7, min=0, max=1, modifier=false, summary=false)
4558    @Description(shortDefinition="Id of resource triggering adjudication", formalDefinition="Original request resource referrence." )
4559    protected Reference request;
4560
4561    /**
4562     * The actual object that is the target of the reference (Original request resource referrence.)
4563     */
4564    protected Claim requestTarget;
4565
4566    /**
4567     * Processing outcome errror, partial or complete processing.
4568     */
4569    @Child(name = "outcome", type = {CodeableConcept.class}, order=8, min=0, max=1, modifier=false, summary=false)
4570    @Description(shortDefinition="complete | error | partial", formalDefinition="Processing outcome errror, partial or complete processing." )
4571    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/remittance-outcome")
4572    protected CodeableConcept outcome;
4573
4574    /**
4575     * A description of the status of the adjudication.
4576     */
4577    @Child(name = "disposition", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=false)
4578    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
4579    protected StringType disposition;
4580
4581    /**
4582     * Party to be reimbursed: Subscriber, provider, other.
4583     */
4584    @Child(name = "payeeType", type = {CodeableConcept.class}, order=10, min=0, max=1, modifier=false, summary=false)
4585    @Description(shortDefinition="Party to be paid any benefits payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
4586    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/payeetype")
4587    protected CodeableConcept payeeType;
4588
4589    /**
4590     * The first tier service adjudications for submitted services.
4591     */
4592    @Child(name = "item", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4593    @Description(shortDefinition="Line items", formalDefinition="The first tier service adjudications for submitted services." )
4594    protected List<ItemComponent> item;
4595
4596    /**
4597     * The first tier service adjudications for payor added services.
4598     */
4599    @Child(name = "addItem", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4600    @Description(shortDefinition="Insurer added line items", formalDefinition="The first tier service adjudications for payor added services." )
4601    protected List<AddedItemComponent> addItem;
4602
4603    /**
4604     * Mutually exclusive with Services Provided (Item).
4605     */
4606    @Child(name = "error", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4607    @Description(shortDefinition="Processing errors", formalDefinition="Mutually exclusive with Services Provided (Item)." )
4608    protected List<ErrorComponent> error;
4609
4610    /**
4611     * The total cost of the services reported.
4612     */
4613    @Child(name = "totalCost", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=false)
4614    @Description(shortDefinition="Total Cost of service from the Claim", formalDefinition="The total cost of the services reported." )
4615    protected Money totalCost;
4616
4617    /**
4618     * The amount of deductible applied which was not allocated to any particular service line.
4619     */
4620    @Child(name = "unallocDeductable", type = {Money.class}, order=15, min=0, max=1, modifier=false, summary=false)
4621    @Description(shortDefinition="Unallocated deductible", formalDefinition="The amount of deductible applied which was not allocated to any particular service line." )
4622    protected Money unallocDeductable;
4623
4624    /**
4625     * Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible).
4626     */
4627    @Child(name = "totalBenefit", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=false)
4628    @Description(shortDefinition="Total benefit payable for the Claim", formalDefinition="Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible)." )
4629    protected Money totalBenefit;
4630
4631    /**
4632     * Payment details for the claim if the claim has been paid.
4633     */
4634    @Child(name = "payment", type = {}, order=17, min=0, max=1, modifier=false, summary=false)
4635    @Description(shortDefinition="Payment details, if paid", formalDefinition="Payment details for the claim if the claim has been paid." )
4636    protected PaymentComponent payment;
4637
4638    /**
4639     * Status of funds reservation (For provider, for Patient, None).
4640     */
4641    @Child(name = "reserved", type = {Coding.class}, order=18, min=0, max=1, modifier=false, summary=false)
4642    @Description(shortDefinition="Funds reserved status", formalDefinition="Status of funds reservation (For provider, for Patient, None)." )
4643    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/fundsreserve")
4644    protected Coding reserved;
4645
4646    /**
4647     * The form to be used for printing the content.
4648     */
4649    @Child(name = "form", type = {CodeableConcept.class}, order=19, min=0, max=1, modifier=false, summary=false)
4650    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
4651    @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/forms")
4652    protected CodeableConcept form;
4653
4654    /**
4655     * Note text.
4656     */
4657    @Child(name = "processNote", type = {}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4658    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
4659    protected List<NoteComponent> processNote;
4660
4661    /**
4662     * Request for additional supporting or authorizing information, such as: documents, images or resources.
4663     */
4664    @Child(name = "communicationRequest", type = {CommunicationRequest.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4665    @Description(shortDefinition="Request for additional information", formalDefinition="Request for additional supporting or authorizing information, such as: documents, images or resources." )
4666    protected List<Reference> communicationRequest;
4667    /**
4668     * The actual objects that are the target of the reference (Request for additional supporting or authorizing information, such as: documents, images or resources.)
4669     */
4670    protected List<CommunicationRequest> communicationRequestTarget;
4671
4672
4673    /**
4674     * Financial instrument by which payment information for health care.
4675     */
4676    @Child(name = "insurance", type = {}, order=22, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false)
4677    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
4678    protected List<InsuranceComponent> insurance;
4679
4680    private static final long serialVersionUID = -488591755L;
4681
4682  /**
4683   * Constructor
4684   */
4685    public ClaimResponse() {
4686      super();
4687    }
4688
4689    /**
4690     * @return {@link #identifier} (The Response business identifier.)
4691     */
4692    public List<Identifier> getIdentifier() { 
4693      if (this.identifier == null)
4694        this.identifier = new ArrayList<Identifier>();
4695      return this.identifier;
4696    }
4697
4698    /**
4699     * @return Returns a reference to <code>this</code> for easy method chaining
4700     */
4701    public ClaimResponse setIdentifier(List<Identifier> theIdentifier) { 
4702      this.identifier = theIdentifier;
4703      return this;
4704    }
4705
4706    public boolean hasIdentifier() { 
4707      if (this.identifier == null)
4708        return false;
4709      for (Identifier item : this.identifier)
4710        if (!item.isEmpty())
4711          return true;
4712      return false;
4713    }
4714
4715    public Identifier addIdentifier() { //3
4716      Identifier t = new Identifier();
4717      if (this.identifier == null)
4718        this.identifier = new ArrayList<Identifier>();
4719      this.identifier.add(t);
4720      return t;
4721    }
4722
4723    public ClaimResponse addIdentifier(Identifier t) { //3
4724      if (t == null)
4725        return this;
4726      if (this.identifier == null)
4727        this.identifier = new ArrayList<Identifier>();
4728      this.identifier.add(t);
4729      return this;
4730    }
4731
4732    /**
4733     * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist
4734     */
4735    public Identifier getIdentifierFirstRep() { 
4736      if (getIdentifier().isEmpty()) {
4737        addIdentifier();
4738      }
4739      return getIdentifier().get(0);
4740    }
4741
4742    /**
4743     * @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
4744     */
4745    public Enumeration<ClaimResponseStatus> getStatusElement() { 
4746      if (this.status == null)
4747        if (Configuration.errorOnAutoCreate())
4748          throw new Error("Attempt to auto-create ClaimResponse.status");
4749        else if (Configuration.doAutoCreate())
4750          this.status = new Enumeration<ClaimResponseStatus>(new ClaimResponseStatusEnumFactory()); // bb
4751      return this.status;
4752    }
4753
4754    public boolean hasStatusElement() { 
4755      return this.status != null && !this.status.isEmpty();
4756    }
4757
4758    public boolean hasStatus() { 
4759      return this.status != null && !this.status.isEmpty();
4760    }
4761
4762    /**
4763     * @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
4764     */
4765    public ClaimResponse setStatusElement(Enumeration<ClaimResponseStatus> value) { 
4766      this.status = value;
4767      return this;
4768    }
4769
4770    /**
4771     * @return The status of the resource instance.
4772     */
4773    public ClaimResponseStatus getStatus() { 
4774      return this.status == null ? null : this.status.getValue();
4775    }
4776
4777    /**
4778     * @param value The status of the resource instance.
4779     */
4780    public ClaimResponse setStatus(ClaimResponseStatus value) { 
4781      if (value == null)
4782        this.status = null;
4783      else {
4784        if (this.status == null)
4785          this.status = new Enumeration<ClaimResponseStatus>(new ClaimResponseStatusEnumFactory());
4786        this.status.setValue(value);
4787      }
4788      return this;
4789    }
4790
4791    /**
4792     * @return {@link #patient} (Patient Resource.)
4793     */
4794    public Reference getPatient() { 
4795      if (this.patient == null)
4796        if (Configuration.errorOnAutoCreate())
4797          throw new Error("Attempt to auto-create ClaimResponse.patient");
4798        else if (Configuration.doAutoCreate())
4799          this.patient = new Reference(); // cc
4800      return this.patient;
4801    }
4802
4803    public boolean hasPatient() { 
4804      return this.patient != null && !this.patient.isEmpty();
4805    }
4806
4807    /**
4808     * @param value {@link #patient} (Patient Resource.)
4809     */
4810    public ClaimResponse setPatient(Reference value) { 
4811      this.patient = value;
4812      return this;
4813    }
4814
4815    /**
4816     * @return {@link #patient} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Patient Resource.)
4817     */
4818    public Patient getPatientTarget() { 
4819      if (this.patientTarget == null)
4820        if (Configuration.errorOnAutoCreate())
4821          throw new Error("Attempt to auto-create ClaimResponse.patient");
4822        else if (Configuration.doAutoCreate())
4823          this.patientTarget = new Patient(); // aa
4824      return this.patientTarget;
4825    }
4826
4827    /**
4828     * @param value {@link #patient} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Patient Resource.)
4829     */
4830    public ClaimResponse setPatientTarget(Patient value) { 
4831      this.patientTarget = value;
4832      return this;
4833    }
4834
4835    /**
4836     * @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
4837     */
4838    public DateTimeType getCreatedElement() { 
4839      if (this.created == null)
4840        if (Configuration.errorOnAutoCreate())
4841          throw new Error("Attempt to auto-create ClaimResponse.created");
4842        else if (Configuration.doAutoCreate())
4843          this.created = new DateTimeType(); // bb
4844      return this.created;
4845    }
4846
4847    public boolean hasCreatedElement() { 
4848      return this.created != null && !this.created.isEmpty();
4849    }
4850
4851    public boolean hasCreated() { 
4852      return this.created != null && !this.created.isEmpty();
4853    }
4854
4855    /**
4856     * @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
4857     */
4858    public ClaimResponse setCreatedElement(DateTimeType value) { 
4859      this.created = value;
4860      return this;
4861    }
4862
4863    /**
4864     * @return The date when the enclosed suite of services were performed or completed.
4865     */
4866    public Date getCreated() { 
4867      return this.created == null ? null : this.created.getValue();
4868    }
4869
4870    /**
4871     * @param value The date when the enclosed suite of services were performed or completed.
4872     */
4873    public ClaimResponse setCreated(Date value) { 
4874      if (value == null)
4875        this.created = null;
4876      else {
4877        if (this.created == null)
4878          this.created = new DateTimeType();
4879        this.created.setValue(value);
4880      }
4881      return this;
4882    }
4883
4884    /**
4885     * @return {@link #insurer} (The Insurer who produced this adjudicated response.)
4886     */
4887    public Reference getInsurer() { 
4888      if (this.insurer == null)
4889        if (Configuration.errorOnAutoCreate())
4890          throw new Error("Attempt to auto-create ClaimResponse.insurer");
4891        else if (Configuration.doAutoCreate())
4892          this.insurer = new Reference(); // cc
4893      return this.insurer;
4894    }
4895
4896    public boolean hasInsurer() { 
4897      return this.insurer != null && !this.insurer.isEmpty();
4898    }
4899
4900    /**
4901     * @param value {@link #insurer} (The Insurer who produced this adjudicated response.)
4902     */
4903    public ClaimResponse setInsurer(Reference value) { 
4904      this.insurer = value;
4905      return this;
4906    }
4907
4908    /**
4909     * @return {@link #insurer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
4910     */
4911    public Organization getInsurerTarget() { 
4912      if (this.insurerTarget == null)
4913        if (Configuration.errorOnAutoCreate())
4914          throw new Error("Attempt to auto-create ClaimResponse.insurer");
4915        else if (Configuration.doAutoCreate())
4916          this.insurerTarget = new Organization(); // aa
4917      return this.insurerTarget;
4918    }
4919
4920    /**
4921     * @param value {@link #insurer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
4922     */
4923    public ClaimResponse setInsurerTarget(Organization value) { 
4924      this.insurerTarget = value;
4925      return this;
4926    }
4927
4928    /**
4929     * @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
4930     */
4931    public Reference getRequestProvider() { 
4932      if (this.requestProvider == null)
4933        if (Configuration.errorOnAutoCreate())
4934          throw new Error("Attempt to auto-create ClaimResponse.requestProvider");
4935        else if (Configuration.doAutoCreate())
4936          this.requestProvider = new Reference(); // cc
4937      return this.requestProvider;
4938    }
4939
4940    public boolean hasRequestProvider() { 
4941      return this.requestProvider != null && !this.requestProvider.isEmpty();
4942    }
4943
4944    /**
4945     * @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
4946     */
4947    public ClaimResponse setRequestProvider(Reference value) { 
4948      this.requestProvider = value;
4949      return this;
4950    }
4951
4952    /**
4953     * @return {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
4954     */
4955    public Practitioner getRequestProviderTarget() { 
4956      if (this.requestProviderTarget == null)
4957        if (Configuration.errorOnAutoCreate())
4958          throw new Error("Attempt to auto-create ClaimResponse.requestProvider");
4959        else if (Configuration.doAutoCreate())
4960          this.requestProviderTarget = new Practitioner(); // aa
4961      return this.requestProviderTarget;
4962    }
4963
4964    /**
4965     * @param value {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
4966     */
4967    public ClaimResponse setRequestProviderTarget(Practitioner value) { 
4968      this.requestProviderTarget = value;
4969      return this;
4970    }
4971
4972    /**
4973     * @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
4974     */
4975    public Reference getRequestOrganization() { 
4976      if (this.requestOrganization == null)
4977        if (Configuration.errorOnAutoCreate())
4978          throw new Error("Attempt to auto-create ClaimResponse.requestOrganization");
4979        else if (Configuration.doAutoCreate())
4980          this.requestOrganization = new Reference(); // cc
4981      return this.requestOrganization;
4982    }
4983
4984    public boolean hasRequestOrganization() { 
4985      return this.requestOrganization != null && !this.requestOrganization.isEmpty();
4986    }
4987
4988    /**
4989     * @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
4990     */
4991    public ClaimResponse setRequestOrganization(Reference value) { 
4992      this.requestOrganization = value;
4993      return this;
4994    }
4995
4996    /**
4997     * @return {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
4998     */
4999    public Organization getRequestOrganizationTarget() { 
5000      if (this.requestOrganizationTarget == null)
5001        if (Configuration.errorOnAutoCreate())
5002          throw new Error("Attempt to auto-create ClaimResponse.requestOrganization");
5003        else if (Configuration.doAutoCreate())
5004          this.requestOrganizationTarget = new Organization(); // aa
5005      return this.requestOrganizationTarget;
5006    }
5007
5008    /**
5009     * @param value {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
5010     */
5011    public ClaimResponse setRequestOrganizationTarget(Organization value) { 
5012      this.requestOrganizationTarget = value;
5013      return this;
5014    }
5015
5016    /**
5017     * @return {@link #request} (Original request resource referrence.)
5018     */
5019    public Reference getRequest() { 
5020      if (this.request == null)
5021        if (Configuration.errorOnAutoCreate())
5022          throw new Error("Attempt to auto-create ClaimResponse.request");
5023        else if (Configuration.doAutoCreate())
5024          this.request = new Reference(); // cc
5025      return this.request;
5026    }
5027
5028    public boolean hasRequest() { 
5029      return this.request != null && !this.request.isEmpty();
5030    }
5031
5032    /**
5033     * @param value {@link #request} (Original request resource referrence.)
5034     */
5035    public ClaimResponse setRequest(Reference value) { 
5036      this.request = value;
5037      return this;
5038    }
5039
5040    /**
5041     * @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original request resource referrence.)
5042     */
5043    public Claim getRequestTarget() { 
5044      if (this.requestTarget == null)
5045        if (Configuration.errorOnAutoCreate())
5046          throw new Error("Attempt to auto-create ClaimResponse.request");
5047        else if (Configuration.doAutoCreate())
5048          this.requestTarget = new Claim(); // aa
5049      return this.requestTarget;
5050    }
5051
5052    /**
5053     * @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original request resource referrence.)
5054     */
5055    public ClaimResponse setRequestTarget(Claim value) { 
5056      this.requestTarget = value;
5057      return this;
5058    }
5059
5060    /**
5061     * @return {@link #outcome} (Processing outcome errror, partial or complete processing.)
5062     */
5063    public CodeableConcept getOutcome() { 
5064      if (this.outcome == null)
5065        if (Configuration.errorOnAutoCreate())
5066          throw new Error("Attempt to auto-create ClaimResponse.outcome");
5067        else if (Configuration.doAutoCreate())
5068          this.outcome = new CodeableConcept(); // cc
5069      return this.outcome;
5070    }
5071
5072    public boolean hasOutcome() { 
5073      return this.outcome != null && !this.outcome.isEmpty();
5074    }
5075
5076    /**
5077     * @param value {@link #outcome} (Processing outcome errror, partial or complete processing.)
5078     */
5079    public ClaimResponse setOutcome(CodeableConcept value) { 
5080      this.outcome = value;
5081      return this;
5082    }
5083
5084    /**
5085     * @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
5086     */
5087    public StringType getDispositionElement() { 
5088      if (this.disposition == null)
5089        if (Configuration.errorOnAutoCreate())
5090          throw new Error("Attempt to auto-create ClaimResponse.disposition");
5091        else if (Configuration.doAutoCreate())
5092          this.disposition = new StringType(); // bb
5093      return this.disposition;
5094    }
5095
5096    public boolean hasDispositionElement() { 
5097      return this.disposition != null && !this.disposition.isEmpty();
5098    }
5099
5100    public boolean hasDisposition() { 
5101      return this.disposition != null && !this.disposition.isEmpty();
5102    }
5103
5104    /**
5105     * @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
5106     */
5107    public ClaimResponse setDispositionElement(StringType value) { 
5108      this.disposition = value;
5109      return this;
5110    }
5111
5112    /**
5113     * @return A description of the status of the adjudication.
5114     */
5115    public String getDisposition() { 
5116      return this.disposition == null ? null : this.disposition.getValue();
5117    }
5118
5119    /**
5120     * @param value A description of the status of the adjudication.
5121     */
5122    public ClaimResponse setDisposition(String value) { 
5123      if (Utilities.noString(value))
5124        this.disposition = null;
5125      else {
5126        if (this.disposition == null)
5127          this.disposition = new StringType();
5128        this.disposition.setValue(value);
5129      }
5130      return this;
5131    }
5132
5133    /**
5134     * @return {@link #payeeType} (Party to be reimbursed: Subscriber, provider, other.)
5135     */
5136    public CodeableConcept getPayeeType() { 
5137      if (this.payeeType == null)
5138        if (Configuration.errorOnAutoCreate())
5139          throw new Error("Attempt to auto-create ClaimResponse.payeeType");
5140        else if (Configuration.doAutoCreate())
5141          this.payeeType = new CodeableConcept(); // cc
5142      return this.payeeType;
5143    }
5144
5145    public boolean hasPayeeType() { 
5146      return this.payeeType != null && !this.payeeType.isEmpty();
5147    }
5148
5149    /**
5150     * @param value {@link #payeeType} (Party to be reimbursed: Subscriber, provider, other.)
5151     */
5152    public ClaimResponse setPayeeType(CodeableConcept value) { 
5153      this.payeeType = value;
5154      return this;
5155    }
5156
5157    /**
5158     * @return {@link #item} (The first tier service adjudications for submitted services.)
5159     */
5160    public List<ItemComponent> getItem() { 
5161      if (this.item == null)
5162        this.item = new ArrayList<ItemComponent>();
5163      return this.item;
5164    }
5165
5166    /**
5167     * @return Returns a reference to <code>this</code> for easy method chaining
5168     */
5169    public ClaimResponse setItem(List<ItemComponent> theItem) { 
5170      this.item = theItem;
5171      return this;
5172    }
5173
5174    public boolean hasItem() { 
5175      if (this.item == null)
5176        return false;
5177      for (ItemComponent item : this.item)
5178        if (!item.isEmpty())
5179          return true;
5180      return false;
5181    }
5182
5183    public ItemComponent addItem() { //3
5184      ItemComponent t = new ItemComponent();
5185      if (this.item == null)
5186        this.item = new ArrayList<ItemComponent>();
5187      this.item.add(t);
5188      return t;
5189    }
5190
5191    public ClaimResponse addItem(ItemComponent t) { //3
5192      if (t == null)
5193        return this;
5194      if (this.item == null)
5195        this.item = new ArrayList<ItemComponent>();
5196      this.item.add(t);
5197      return this;
5198    }
5199
5200    /**
5201     * @return The first repetition of repeating field {@link #item}, creating it if it does not already exist
5202     */
5203    public ItemComponent getItemFirstRep() { 
5204      if (getItem().isEmpty()) {
5205        addItem();
5206      }
5207      return getItem().get(0);
5208    }
5209
5210    /**
5211     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
5212     */
5213    public List<AddedItemComponent> getAddItem() { 
5214      if (this.addItem == null)
5215        this.addItem = new ArrayList<AddedItemComponent>();
5216      return this.addItem;
5217    }
5218
5219    /**
5220     * @return Returns a reference to <code>this</code> for easy method chaining
5221     */
5222    public ClaimResponse setAddItem(List<AddedItemComponent> theAddItem) { 
5223      this.addItem = theAddItem;
5224      return this;
5225    }
5226
5227    public boolean hasAddItem() { 
5228      if (this.addItem == null)
5229        return false;
5230      for (AddedItemComponent item : this.addItem)
5231        if (!item.isEmpty())
5232          return true;
5233      return false;
5234    }
5235
5236    public AddedItemComponent addAddItem() { //3
5237      AddedItemComponent t = new AddedItemComponent();
5238      if (this.addItem == null)
5239        this.addItem = new ArrayList<AddedItemComponent>();
5240      this.addItem.add(t);
5241      return t;
5242    }
5243
5244    public ClaimResponse addAddItem(AddedItemComponent t) { //3
5245      if (t == null)
5246        return this;
5247      if (this.addItem == null)
5248        this.addItem = new ArrayList<AddedItemComponent>();
5249      this.addItem.add(t);
5250      return this;
5251    }
5252
5253    /**
5254     * @return The first repetition of repeating field {@link #addItem}, creating it if it does not already exist
5255     */
5256    public AddedItemComponent getAddItemFirstRep() { 
5257      if (getAddItem().isEmpty()) {
5258        addAddItem();
5259      }
5260      return getAddItem().get(0);
5261    }
5262
5263    /**
5264     * @return {@link #error} (Mutually exclusive with Services Provided (Item).)
5265     */
5266    public List<ErrorComponent> getError() { 
5267      if (this.error == null)
5268        this.error = new ArrayList<ErrorComponent>();
5269      return this.error;
5270    }
5271
5272    /**
5273     * @return Returns a reference to <code>this</code> for easy method chaining
5274     */
5275    public ClaimResponse setError(List<ErrorComponent> theError) { 
5276      this.error = theError;
5277      return this;
5278    }
5279
5280    public boolean hasError() { 
5281      if (this.error == null)
5282        return false;
5283      for (ErrorComponent item : this.error)
5284        if (!item.isEmpty())
5285          return true;
5286      return false;
5287    }
5288
5289    public ErrorComponent addError() { //3
5290      ErrorComponent t = new ErrorComponent();
5291      if (this.error == null)
5292        this.error = new ArrayList<ErrorComponent>();
5293      this.error.add(t);
5294      return t;
5295    }
5296
5297    public ClaimResponse addError(ErrorComponent t) { //3
5298      if (t == null)
5299        return this;
5300      if (this.error == null)
5301        this.error = new ArrayList<ErrorComponent>();
5302      this.error.add(t);
5303      return this;
5304    }
5305
5306    /**
5307     * @return The first repetition of repeating field {@link #error}, creating it if it does not already exist
5308     */
5309    public ErrorComponent getErrorFirstRep() { 
5310      if (getError().isEmpty()) {
5311        addError();
5312      }
5313      return getError().get(0);
5314    }
5315
5316    /**
5317     * @return {@link #totalCost} (The total cost of the services reported.)
5318     */
5319    public Money getTotalCost() { 
5320      if (this.totalCost == null)
5321        if (Configuration.errorOnAutoCreate())
5322          throw new Error("Attempt to auto-create ClaimResponse.totalCost");
5323        else if (Configuration.doAutoCreate())
5324          this.totalCost = new Money(); // cc
5325      return this.totalCost;
5326    }
5327
5328    public boolean hasTotalCost() { 
5329      return this.totalCost != null && !this.totalCost.isEmpty();
5330    }
5331
5332    /**
5333     * @param value {@link #totalCost} (The total cost of the services reported.)
5334     */
5335    public ClaimResponse setTotalCost(Money value) { 
5336      this.totalCost = value;
5337      return this;
5338    }
5339
5340    /**
5341     * @return {@link #unallocDeductable} (The amount of deductible applied which was not allocated to any particular service line.)
5342     */
5343    public Money getUnallocDeductable() { 
5344      if (this.unallocDeductable == null)
5345        if (Configuration.errorOnAutoCreate())
5346          throw new Error("Attempt to auto-create ClaimResponse.unallocDeductable");
5347        else if (Configuration.doAutoCreate())
5348          this.unallocDeductable = new Money(); // cc
5349      return this.unallocDeductable;
5350    }
5351
5352    public boolean hasUnallocDeductable() { 
5353      return this.unallocDeductable != null && !this.unallocDeductable.isEmpty();
5354    }
5355
5356    /**
5357     * @param value {@link #unallocDeductable} (The amount of deductible applied which was not allocated to any particular service line.)
5358     */
5359    public ClaimResponse setUnallocDeductable(Money value) { 
5360      this.unallocDeductable = value;
5361      return this;
5362    }
5363
5364    /**
5365     * @return {@link #totalBenefit} (Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible).)
5366     */
5367    public Money getTotalBenefit() { 
5368      if (this.totalBenefit == null)
5369        if (Configuration.errorOnAutoCreate())
5370          throw new Error("Attempt to auto-create ClaimResponse.totalBenefit");
5371        else if (Configuration.doAutoCreate())
5372          this.totalBenefit = new Money(); // cc
5373      return this.totalBenefit;
5374    }
5375
5376    public boolean hasTotalBenefit() { 
5377      return this.totalBenefit != null && !this.totalBenefit.isEmpty();
5378    }
5379
5380    /**
5381     * @param value {@link #totalBenefit} (Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible).)
5382     */
5383    public ClaimResponse setTotalBenefit(Money value) { 
5384      this.totalBenefit = value;
5385      return this;
5386    }
5387
5388    /**
5389     * @return {@link #payment} (Payment details for the claim if the claim has been paid.)
5390     */
5391    public PaymentComponent getPayment() { 
5392      if (this.payment == null)
5393        if (Configuration.errorOnAutoCreate())
5394          throw new Error("Attempt to auto-create ClaimResponse.payment");
5395        else if (Configuration.doAutoCreate())
5396          this.payment = new PaymentComponent(); // cc
5397      return this.payment;
5398    }
5399
5400    public boolean hasPayment() { 
5401      return this.payment != null && !this.payment.isEmpty();
5402    }
5403
5404    /**
5405     * @param value {@link #payment} (Payment details for the claim if the claim has been paid.)
5406     */
5407    public ClaimResponse setPayment(PaymentComponent value) { 
5408      this.payment = value;
5409      return this;
5410    }
5411
5412    /**
5413     * @return {@link #reserved} (Status of funds reservation (For provider, for Patient, None).)
5414     */
5415    public Coding getReserved() { 
5416      if (this.reserved == null)
5417        if (Configuration.errorOnAutoCreate())
5418          throw new Error("Attempt to auto-create ClaimResponse.reserved");
5419        else if (Configuration.doAutoCreate())
5420          this.reserved = new Coding(); // cc
5421      return this.reserved;
5422    }
5423
5424    public boolean hasReserved() { 
5425      return this.reserved != null && !this.reserved.isEmpty();
5426    }
5427
5428    /**
5429     * @param value {@link #reserved} (Status of funds reservation (For provider, for Patient, None).)
5430     */
5431    public ClaimResponse setReserved(Coding value) { 
5432      this.reserved = value;
5433      return this;
5434    }
5435
5436    /**
5437     * @return {@link #form} (The form to be used for printing the content.)
5438     */
5439    public CodeableConcept getForm() { 
5440      if (this.form == null)
5441        if (Configuration.errorOnAutoCreate())
5442          throw new Error("Attempt to auto-create ClaimResponse.form");
5443        else if (Configuration.doAutoCreate())
5444          this.form = new CodeableConcept(); // cc
5445      return this.form;
5446    }
5447
5448    public boolean hasForm() { 
5449      return this.form != null && !this.form.isEmpty();
5450    }
5451
5452    /**
5453     * @param value {@link #form} (The form to be used for printing the content.)
5454     */
5455    public ClaimResponse setForm(CodeableConcept value) { 
5456      this.form = value;
5457      return this;
5458    }
5459
5460    /**
5461     * @return {@link #processNote} (Note text.)
5462     */
5463    public List<NoteComponent> getProcessNote() { 
5464      if (this.processNote == null)
5465        this.processNote = new ArrayList<NoteComponent>();
5466      return this.processNote;
5467    }
5468
5469    /**
5470     * @return Returns a reference to <code>this</code> for easy method chaining
5471     */
5472    public ClaimResponse setProcessNote(List<NoteComponent> theProcessNote) { 
5473      this.processNote = theProcessNote;
5474      return this;
5475    }
5476
5477    public boolean hasProcessNote() { 
5478      if (this.processNote == null)
5479        return false;
5480      for (NoteComponent item : this.processNote)
5481        if (!item.isEmpty())
5482          return true;
5483      return false;
5484    }
5485
5486    public NoteComponent addProcessNote() { //3
5487      NoteComponent t = new NoteComponent();
5488      if (this.processNote == null)
5489        this.processNote = new ArrayList<NoteComponent>();
5490      this.processNote.add(t);
5491      return t;
5492    }
5493
5494    public ClaimResponse addProcessNote(NoteComponent t) { //3
5495      if (t == null)
5496        return this;
5497      if (this.processNote == null)
5498        this.processNote = new ArrayList<NoteComponent>();
5499      this.processNote.add(t);
5500      return this;
5501    }
5502
5503    /**
5504     * @return The first repetition of repeating field {@link #processNote}, creating it if it does not already exist
5505     */
5506    public NoteComponent getProcessNoteFirstRep() { 
5507      if (getProcessNote().isEmpty()) {
5508        addProcessNote();
5509      }
5510      return getProcessNote().get(0);
5511    }
5512
5513    /**
5514     * @return {@link #communicationRequest} (Request for additional supporting or authorizing information, such as: documents, images or resources.)
5515     */
5516    public List<Reference> getCommunicationRequest() { 
5517      if (this.communicationRequest == null)
5518        this.communicationRequest = new ArrayList<Reference>();
5519      return this.communicationRequest;
5520    }
5521
5522    /**
5523     * @return Returns a reference to <code>this</code> for easy method chaining
5524     */
5525    public ClaimResponse setCommunicationRequest(List<Reference> theCommunicationRequest) { 
5526      this.communicationRequest = theCommunicationRequest;
5527      return this;
5528    }
5529
5530    public boolean hasCommunicationRequest() { 
5531      if (this.communicationRequest == null)
5532        return false;
5533      for (Reference item : this.communicationRequest)
5534        if (!item.isEmpty())
5535          return true;
5536      return false;
5537    }
5538
5539    public Reference addCommunicationRequest() { //3
5540      Reference t = new Reference();
5541      if (this.communicationRequest == null)
5542        this.communicationRequest = new ArrayList<Reference>();
5543      this.communicationRequest.add(t);
5544      return t;
5545    }
5546
5547    public ClaimResponse addCommunicationRequest(Reference t) { //3
5548      if (t == null)
5549        return this;
5550      if (this.communicationRequest == null)
5551        this.communicationRequest = new ArrayList<Reference>();
5552      this.communicationRequest.add(t);
5553      return this;
5554    }
5555
5556    /**
5557     * @return The first repetition of repeating field {@link #communicationRequest}, creating it if it does not already exist
5558     */
5559    public Reference getCommunicationRequestFirstRep() { 
5560      if (getCommunicationRequest().isEmpty()) {
5561        addCommunicationRequest();
5562      }
5563      return getCommunicationRequest().get(0);
5564    }
5565
5566    /**
5567     * @deprecated Use Reference#setResource(IBaseResource) instead
5568     */
5569    @Deprecated
5570    public List<CommunicationRequest> getCommunicationRequestTarget() { 
5571      if (this.communicationRequestTarget == null)
5572        this.communicationRequestTarget = new ArrayList<CommunicationRequest>();
5573      return this.communicationRequestTarget;
5574    }
5575
5576    /**
5577     * @deprecated Use Reference#setResource(IBaseResource) instead
5578     */
5579    @Deprecated
5580    public CommunicationRequest addCommunicationRequestTarget() { 
5581      CommunicationRequest r = new CommunicationRequest();
5582      if (this.communicationRequestTarget == null)
5583        this.communicationRequestTarget = new ArrayList<CommunicationRequest>();
5584      this.communicationRequestTarget.add(r);
5585      return r;
5586    }
5587
5588    /**
5589     * @return {@link #insurance} (Financial instrument by which payment information for health care.)
5590     */
5591    public List<InsuranceComponent> getInsurance() { 
5592      if (this.insurance == null)
5593        this.insurance = new ArrayList<InsuranceComponent>();
5594      return this.insurance;
5595    }
5596
5597    /**
5598     * @return Returns a reference to <code>this</code> for easy method chaining
5599     */
5600    public ClaimResponse setInsurance(List<InsuranceComponent> theInsurance) { 
5601      this.insurance = theInsurance;
5602      return this;
5603    }
5604
5605    public boolean hasInsurance() { 
5606      if (this.insurance == null)
5607        return false;
5608      for (InsuranceComponent item : this.insurance)
5609        if (!item.isEmpty())
5610          return true;
5611      return false;
5612    }
5613
5614    public InsuranceComponent addInsurance() { //3
5615      InsuranceComponent t = new InsuranceComponent();
5616      if (this.insurance == null)
5617        this.insurance = new ArrayList<InsuranceComponent>();
5618      this.insurance.add(t);
5619      return t;
5620    }
5621
5622    public ClaimResponse addInsurance(InsuranceComponent t) { //3
5623      if (t == null)
5624        return this;
5625      if (this.insurance == null)
5626        this.insurance = new ArrayList<InsuranceComponent>();
5627      this.insurance.add(t);
5628      return this;
5629    }
5630
5631    /**
5632     * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist
5633     */
5634    public InsuranceComponent getInsuranceFirstRep() { 
5635      if (getInsurance().isEmpty()) {
5636        addInsurance();
5637      }
5638      return getInsurance().get(0);
5639    }
5640
5641      protected void listChildren(List<Property> childrenList) {
5642        super.listChildren(childrenList);
5643        childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
5644        childrenList.add(new Property("status", "code", "The status of the resource instance.", 0, java.lang.Integer.MAX_VALUE, status));
5645        childrenList.add(new Property("patient", "Reference(Patient)", "Patient Resource.", 0, java.lang.Integer.MAX_VALUE, patient));
5646        childrenList.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, created));
5647        childrenList.add(new Property("insurer", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, java.lang.Integer.MAX_VALUE, insurer));
5648        childrenList.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestProvider));
5649        childrenList.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestOrganization));
5650        childrenList.add(new Property("request", "Reference(Claim)", "Original request resource referrence.", 0, java.lang.Integer.MAX_VALUE, request));
5651        childrenList.add(new Property("outcome", "CodeableConcept", "Processing outcome errror, partial or complete processing.", 0, java.lang.Integer.MAX_VALUE, outcome));
5652        childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, java.lang.Integer.MAX_VALUE, disposition));
5653        childrenList.add(new Property("payeeType", "CodeableConcept", "Party to be reimbursed: Subscriber, provider, other.", 0, java.lang.Integer.MAX_VALUE, payeeType));
5654        childrenList.add(new Property("item", "", "The first tier service adjudications for submitted services.", 0, java.lang.Integer.MAX_VALUE, item));
5655        childrenList.add(new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
5656        childrenList.add(new Property("error", "", "Mutually exclusive with Services Provided (Item).", 0, java.lang.Integer.MAX_VALUE, error));
5657        childrenList.add(new Property("totalCost", "Money", "The total cost of the services reported.", 0, java.lang.Integer.MAX_VALUE, totalCost));
5658        childrenList.add(new Property("unallocDeductable", "Money", "The amount of deductible applied which was not allocated to any particular service line.", 0, java.lang.Integer.MAX_VALUE, unallocDeductable));
5659        childrenList.add(new Property("totalBenefit", "Money", "Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible).", 0, java.lang.Integer.MAX_VALUE, totalBenefit));
5660        childrenList.add(new Property("payment", "", "Payment details for the claim if the claim has been paid.", 0, java.lang.Integer.MAX_VALUE, payment));
5661        childrenList.add(new Property("reserved", "Coding", "Status of funds reservation (For provider, for Patient, None).", 0, java.lang.Integer.MAX_VALUE, reserved));
5662        childrenList.add(new Property("form", "CodeableConcept", "The form to be used for printing the content.", 0, java.lang.Integer.MAX_VALUE, form));
5663        childrenList.add(new Property("processNote", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, processNote));
5664        childrenList.add(new Property("communicationRequest", "Reference(CommunicationRequest)", "Request for additional supporting or authorizing information, such as: documents, images or resources.", 0, java.lang.Integer.MAX_VALUE, communicationRequest));
5665        childrenList.add(new Property("insurance", "", "Financial instrument by which payment information for health care.", 0, java.lang.Integer.MAX_VALUE, insurance));
5666      }
5667
5668      @Override
5669      public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException {
5670        switch (hash) {
5671        case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier
5672        case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration<ClaimResponseStatus>
5673        case -791418107: /*patient*/ return this.patient == null ? new Base[0] : new Base[] {this.patient}; // Reference
5674        case 1028554472: /*created*/ return this.created == null ? new Base[0] : new Base[] {this.created}; // DateTimeType
5675        case 1957615864: /*insurer*/ return this.insurer == null ? new Base[0] : new Base[] {this.insurer}; // Reference
5676        case 1601527200: /*requestProvider*/ return this.requestProvider == null ? new Base[0] : new Base[] {this.requestProvider}; // Reference
5677        case 599053666: /*requestOrganization*/ return this.requestOrganization == null ? new Base[0] : new Base[] {this.requestOrganization}; // Reference
5678        case 1095692943: /*request*/ return this.request == null ? new Base[0] : new Base[] {this.request}; // Reference
5679        case -1106507950: /*outcome*/ return this.outcome == null ? new Base[0] : new Base[] {this.outcome}; // CodeableConcept
5680        case 583380919: /*disposition*/ return this.disposition == null ? new Base[0] : new Base[] {this.disposition}; // StringType
5681        case -316321118: /*payeeType*/ return this.payeeType == null ? new Base[0] : new Base[] {this.payeeType}; // CodeableConcept
5682        case 3242771: /*item*/ return this.item == null ? new Base[0] : this.item.toArray(new Base[this.item.size()]); // ItemComponent
5683        case -1148899500: /*addItem*/ return this.addItem == null ? new Base[0] : this.addItem.toArray(new Base[this.addItem.size()]); // AddedItemComponent
5684        case 96784904: /*error*/ return this.error == null ? new Base[0] : this.error.toArray(new Base[this.error.size()]); // ErrorComponent
5685        case -577782479: /*totalCost*/ return this.totalCost == null ? new Base[0] : new Base[] {this.totalCost}; // Money
5686        case 2096309753: /*unallocDeductable*/ return this.unallocDeductable == null ? new Base[0] : new Base[] {this.unallocDeductable}; // Money
5687        case 332332211: /*totalBenefit*/ return this.totalBenefit == null ? new Base[0] : new Base[] {this.totalBenefit}; // Money
5688        case -786681338: /*payment*/ return this.payment == null ? new Base[0] : new Base[] {this.payment}; // PaymentComponent
5689        case -350385368: /*reserved*/ return this.reserved == null ? new Base[0] : new Base[] {this.reserved}; // Coding
5690        case 3148996: /*form*/ return this.form == null ? new Base[0] : new Base[] {this.form}; // CodeableConcept
5691        case 202339073: /*processNote*/ return this.processNote == null ? new Base[0] : this.processNote.toArray(new Base[this.processNote.size()]); // NoteComponent
5692        case -2071896615: /*communicationRequest*/ return this.communicationRequest == null ? new Base[0] : this.communicationRequest.toArray(new Base[this.communicationRequest.size()]); // Reference
5693        case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // InsuranceComponent
5694        default: return super.getProperty(hash, name, checkValid);
5695        }
5696
5697      }
5698
5699      @Override
5700      public Base setProperty(int hash, String name, Base value) throws FHIRException {
5701        switch (hash) {
5702        case -1618432855: // identifier
5703          this.getIdentifier().add(castToIdentifier(value)); // Identifier
5704          return value;
5705        case -892481550: // status
5706          value = new ClaimResponseStatusEnumFactory().fromType(castToCode(value));
5707          this.status = (Enumeration) value; // Enumeration<ClaimResponseStatus>
5708          return value;
5709        case -791418107: // patient
5710          this.patient = castToReference(value); // Reference
5711          return value;
5712        case 1028554472: // created
5713          this.created = castToDateTime(value); // DateTimeType
5714          return value;
5715        case 1957615864: // insurer
5716          this.insurer = castToReference(value); // Reference
5717          return value;
5718        case 1601527200: // requestProvider
5719          this.requestProvider = castToReference(value); // Reference
5720          return value;
5721        case 599053666: // requestOrganization
5722          this.requestOrganization = castToReference(value); // Reference
5723          return value;
5724        case 1095692943: // request
5725          this.request = castToReference(value); // Reference
5726          return value;
5727        case -1106507950: // outcome
5728          this.outcome = castToCodeableConcept(value); // CodeableConcept
5729          return value;
5730        case 583380919: // disposition
5731          this.disposition = castToString(value); // StringType
5732          return value;
5733        case -316321118: // payeeType
5734          this.payeeType = castToCodeableConcept(value); // CodeableConcept
5735          return value;
5736        case 3242771: // item
5737          this.getItem().add((ItemComponent) value); // ItemComponent
5738          return value;
5739        case -1148899500: // addItem
5740          this.getAddItem().add((AddedItemComponent) value); // AddedItemComponent
5741          return value;
5742        case 96784904: // error
5743          this.getError().add((ErrorComponent) value); // ErrorComponent
5744          return value;
5745        case -577782479: // totalCost
5746          this.totalCost = castToMoney(value); // Money
5747          return value;
5748        case 2096309753: // unallocDeductable
5749          this.unallocDeductable = castToMoney(value); // Money
5750          return value;
5751        case 332332211: // totalBenefit
5752          this.totalBenefit = castToMoney(value); // Money
5753          return value;
5754        case -786681338: // payment
5755          this.payment = (PaymentComponent) value; // PaymentComponent
5756          return value;
5757        case -350385368: // reserved
5758          this.reserved = castToCoding(value); // Coding
5759          return value;
5760        case 3148996: // form
5761          this.form = castToCodeableConcept(value); // CodeableConcept
5762          return value;
5763        case 202339073: // processNote
5764          this.getProcessNote().add((NoteComponent) value); // NoteComponent
5765          return value;
5766        case -2071896615: // communicationRequest
5767          this.getCommunicationRequest().add(castToReference(value)); // Reference
5768          return value;
5769        case 73049818: // insurance
5770          this.getInsurance().add((InsuranceComponent) value); // InsuranceComponent
5771          return value;
5772        default: return super.setProperty(hash, name, value);
5773        }
5774
5775      }
5776
5777      @Override
5778      public Base setProperty(String name, Base value) throws FHIRException {
5779        if (name.equals("identifier")) {
5780          this.getIdentifier().add(castToIdentifier(value));
5781        } else if (name.equals("status")) {
5782          value = new ClaimResponseStatusEnumFactory().fromType(castToCode(value));
5783          this.status = (Enumeration) value; // Enumeration<ClaimResponseStatus>
5784        } else if (name.equals("patient")) {
5785          this.patient = castToReference(value); // Reference
5786        } else if (name.equals("created")) {
5787          this.created = castToDateTime(value); // DateTimeType
5788        } else if (name.equals("insurer")) {
5789          this.insurer = castToReference(value); // Reference
5790        } else if (name.equals("requestProvider")) {
5791          this.requestProvider = castToReference(value); // Reference
5792        } else if (name.equals("requestOrganization")) {
5793          this.requestOrganization = castToReference(value); // Reference
5794        } else if (name.equals("request")) {
5795          this.request = castToReference(value); // Reference
5796        } else if (name.equals("outcome")) {
5797          this.outcome = castToCodeableConcept(value); // CodeableConcept
5798        } else if (name.equals("disposition")) {
5799          this.disposition = castToString(value); // StringType
5800        } else if (name.equals("payeeType")) {
5801          this.payeeType = castToCodeableConcept(value); // CodeableConcept
5802        } else if (name.equals("item")) {
5803          this.getItem().add((ItemComponent) value);
5804        } else if (name.equals("addItem")) {
5805          this.getAddItem().add((AddedItemComponent) value);
5806        } else if (name.equals("error")) {
5807          this.getError().add((ErrorComponent) value);
5808        } else if (name.equals("totalCost")) {
5809          this.totalCost = castToMoney(value); // Money
5810        } else if (name.equals("unallocDeductable")) {
5811          this.unallocDeductable = castToMoney(value); // Money
5812        } else if (name.equals("totalBenefit")) {
5813          this.totalBenefit = castToMoney(value); // Money
5814        } else if (name.equals("payment")) {
5815          this.payment = (PaymentComponent) value; // PaymentComponent
5816        } else if (name.equals("reserved")) {
5817          this.reserved = castToCoding(value); // Coding
5818        } else if (name.equals("form")) {
5819          this.form = castToCodeableConcept(value); // CodeableConcept
5820        } else if (name.equals("processNote")) {
5821          this.getProcessNote().add((NoteComponent) value);
5822        } else if (name.equals("communicationRequest")) {
5823          this.getCommunicationRequest().add(castToReference(value));
5824        } else if (name.equals("insurance")) {
5825          this.getInsurance().add((InsuranceComponent) value);
5826        } else
5827          return super.setProperty(name, value);
5828        return value;
5829      }
5830
5831      @Override
5832      public Base makeProperty(int hash, String name) throws FHIRException {
5833        switch (hash) {
5834        case -1618432855:  return addIdentifier(); 
5835        case -892481550:  return getStatusElement();
5836        case -791418107:  return getPatient(); 
5837        case 1028554472:  return getCreatedElement();
5838        case 1957615864:  return getInsurer(); 
5839        case 1601527200:  return getRequestProvider(); 
5840        case 599053666:  return getRequestOrganization(); 
5841        case 1095692943:  return getRequest(); 
5842        case -1106507950:  return getOutcome(); 
5843        case 583380919:  return getDispositionElement();
5844        case -316321118:  return getPayeeType(); 
5845        case 3242771:  return addItem(); 
5846        case -1148899500:  return addAddItem(); 
5847        case 96784904:  return addError(); 
5848        case -577782479:  return getTotalCost(); 
5849        case 2096309753:  return getUnallocDeductable(); 
5850        case 332332211:  return getTotalBenefit(); 
5851        case -786681338:  return getPayment(); 
5852        case -350385368:  return getReserved(); 
5853        case 3148996:  return getForm(); 
5854        case 202339073:  return addProcessNote(); 
5855        case -2071896615:  return addCommunicationRequest(); 
5856        case 73049818:  return addInsurance(); 
5857        default: return super.makeProperty(hash, name);
5858        }
5859
5860      }
5861
5862      @Override
5863      public String[] getTypesForProperty(int hash, String name) throws FHIRException {
5864        switch (hash) {
5865        case -1618432855: /*identifier*/ return new String[] {"Identifier"};
5866        case -892481550: /*status*/ return new String[] {"code"};
5867        case -791418107: /*patient*/ return new String[] {"Reference"};
5868        case 1028554472: /*created*/ return new String[] {"dateTime"};
5869        case 1957615864: /*insurer*/ return new String[] {"Reference"};
5870        case 1601527200: /*requestProvider*/ return new String[] {"Reference"};
5871        case 599053666: /*requestOrganization*/ return new String[] {"Reference"};
5872        case 1095692943: /*request*/ return new String[] {"Reference"};
5873        case -1106507950: /*outcome*/ return new String[] {"CodeableConcept"};
5874        case 583380919: /*disposition*/ return new String[] {"string"};
5875        case -316321118: /*payeeType*/ return new String[] {"CodeableConcept"};
5876        case 3242771: /*item*/ return new String[] {};
5877        case -1148899500: /*addItem*/ return new String[] {};
5878        case 96784904: /*error*/ return new String[] {};
5879        case -577782479: /*totalCost*/ return new String[] {"Money"};
5880        case 2096309753: /*unallocDeductable*/ return new String[] {"Money"};
5881        case 332332211: /*totalBenefit*/ return new String[] {"Money"};
5882        case -786681338: /*payment*/ return new String[] {};
5883        case -350385368: /*reserved*/ return new String[] {"Coding"};
5884        case 3148996: /*form*/ return new String[] {"CodeableConcept"};
5885        case 202339073: /*processNote*/ return new String[] {};
5886        case -2071896615: /*communicationRequest*/ return new String[] {"Reference"};
5887        case 73049818: /*insurance*/ return new String[] {};
5888        default: return super.getTypesForProperty(hash, name);
5889        }
5890
5891      }
5892
5893      @Override
5894      public Base addChild(String name) throws FHIRException {
5895        if (name.equals("identifier")) {
5896          return addIdentifier();
5897        }
5898        else if (name.equals("status")) {
5899          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.status");
5900        }
5901        else if (name.equals("patient")) {
5902          this.patient = new Reference();
5903          return this.patient;
5904        }
5905        else if (name.equals("created")) {
5906          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.created");
5907        }
5908        else if (name.equals("insurer")) {
5909          this.insurer = new Reference();
5910          return this.insurer;
5911        }
5912        else if (name.equals("requestProvider")) {
5913          this.requestProvider = new Reference();
5914          return this.requestProvider;
5915        }
5916        else if (name.equals("requestOrganization")) {
5917          this.requestOrganization = new Reference();
5918          return this.requestOrganization;
5919        }
5920        else if (name.equals("request")) {
5921          this.request = new Reference();
5922          return this.request;
5923        }
5924        else if (name.equals("outcome")) {
5925          this.outcome = new CodeableConcept();
5926          return this.outcome;
5927        }
5928        else if (name.equals("disposition")) {
5929          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.disposition");
5930        }
5931        else if (name.equals("payeeType")) {
5932          this.payeeType = new CodeableConcept();
5933          return this.payeeType;
5934        }
5935        else if (name.equals("item")) {
5936          return addItem();
5937        }
5938        else if (name.equals("addItem")) {
5939          return addAddItem();
5940        }
5941        else if (name.equals("error")) {
5942          return addError();
5943        }
5944        else if (name.equals("totalCost")) {
5945          this.totalCost = new Money();
5946          return this.totalCost;
5947        }
5948        else if (name.equals("unallocDeductable")) {
5949          this.unallocDeductable = new Money();
5950          return this.unallocDeductable;
5951        }
5952        else if (name.equals("totalBenefit")) {
5953          this.totalBenefit = new Money();
5954          return this.totalBenefit;
5955        }
5956        else if (name.equals("payment")) {
5957          this.payment = new PaymentComponent();
5958          return this.payment;
5959        }
5960        else if (name.equals("reserved")) {
5961          this.reserved = new Coding();
5962          return this.reserved;
5963        }
5964        else if (name.equals("form")) {
5965          this.form = new CodeableConcept();
5966          return this.form;
5967        }
5968        else if (name.equals("processNote")) {
5969          return addProcessNote();
5970        }
5971        else if (name.equals("communicationRequest")) {
5972          return addCommunicationRequest();
5973        }
5974        else if (name.equals("insurance")) {
5975          return addInsurance();
5976        }
5977        else
5978          return super.addChild(name);
5979      }
5980
5981  public String fhirType() {
5982    return "ClaimResponse";
5983
5984  }
5985
5986      public ClaimResponse copy() {
5987        ClaimResponse dst = new ClaimResponse();
5988        copyValues(dst);
5989        if (identifier != null) {
5990          dst.identifier = new ArrayList<Identifier>();
5991          for (Identifier i : identifier)
5992            dst.identifier.add(i.copy());
5993        };
5994        dst.status = status == null ? null : status.copy();
5995        dst.patient = patient == null ? null : patient.copy();
5996        dst.created = created == null ? null : created.copy();
5997        dst.insurer = insurer == null ? null : insurer.copy();
5998        dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
5999        dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
6000        dst.request = request == null ? null : request.copy();
6001        dst.outcome = outcome == null ? null : outcome.copy();
6002        dst.disposition = disposition == null ? null : disposition.copy();
6003        dst.payeeType = payeeType == null ? null : payeeType.copy();
6004        if (item != null) {
6005          dst.item = new ArrayList<ItemComponent>();
6006          for (ItemComponent i : item)
6007            dst.item.add(i.copy());
6008        };
6009        if (addItem != null) {
6010          dst.addItem = new ArrayList<AddedItemComponent>();
6011          for (AddedItemComponent i : addItem)
6012            dst.addItem.add(i.copy());
6013        };
6014        if (error != null) {
6015          dst.error = new ArrayList<ErrorComponent>();
6016          for (ErrorComponent i : error)
6017            dst.error.add(i.copy());
6018        };
6019        dst.totalCost = totalCost == null ? null : totalCost.copy();
6020        dst.unallocDeductable = unallocDeductable == null ? null : unallocDeductable.copy();
6021        dst.totalBenefit = totalBenefit == null ? null : totalBenefit.copy();
6022        dst.payment = payment == null ? null : payment.copy();
6023        dst.reserved = reserved == null ? null : reserved.copy();
6024        dst.form = form == null ? null : form.copy();
6025        if (processNote != null) {
6026          dst.processNote = new ArrayList<NoteComponent>();
6027          for (NoteComponent i : processNote)
6028            dst.processNote.add(i.copy());
6029        };
6030        if (communicationRequest != null) {
6031          dst.communicationRequest = new ArrayList<Reference>();
6032          for (Reference i : communicationRequest)
6033            dst.communicationRequest.add(i.copy());
6034        };
6035        if (insurance != null) {
6036          dst.insurance = new ArrayList<InsuranceComponent>();
6037          for (InsuranceComponent i : insurance)
6038            dst.insurance.add(i.copy());
6039        };
6040        return dst;
6041      }
6042
6043      protected ClaimResponse typedCopy() {
6044        return copy();
6045      }
6046
6047      @Override
6048      public boolean equalsDeep(Base other) {
6049        if (!super.equalsDeep(other))
6050          return false;
6051        if (!(other instanceof ClaimResponse))
6052          return false;
6053        ClaimResponse o = (ClaimResponse) other;
6054        return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(patient, o.patient, true)
6055           && compareDeep(created, o.created, true) && compareDeep(insurer, o.insurer, true) && compareDeep(requestProvider, o.requestProvider, true)
6056           && compareDeep(requestOrganization, o.requestOrganization, true) && compareDeep(request, o.request, true)
6057           && compareDeep(outcome, o.outcome, true) && compareDeep(disposition, o.disposition, true) && compareDeep(payeeType, o.payeeType, true)
6058           && compareDeep(item, o.item, true) && compareDeep(addItem, o.addItem, true) && compareDeep(error, o.error, true)
6059           && compareDeep(totalCost, o.totalCost, true) && compareDeep(unallocDeductable, o.unallocDeductable, true)
6060           && compareDeep(totalBenefit, o.totalBenefit, true) && compareDeep(payment, o.payment, true) && compareDeep(reserved, o.reserved, true)
6061           && compareDeep(form, o.form, true) && compareDeep(processNote, o.processNote, true) && compareDeep(communicationRequest, o.communicationRequest, true)
6062           && compareDeep(insurance, o.insurance, true);
6063      }
6064
6065      @Override
6066      public boolean equalsShallow(Base other) {
6067        if (!super.equalsShallow(other))
6068          return false;
6069        if (!(other instanceof ClaimResponse))
6070          return false;
6071        ClaimResponse o = (ClaimResponse) other;
6072        return compareValues(status, o.status, true) && compareValues(created, o.created, true) && compareValues(disposition, o.disposition, true)
6073          ;
6074      }
6075
6076      public boolean isEmpty() {
6077        return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, patient
6078          , created, insurer, requestProvider, requestOrganization, request, outcome, disposition
6079          , payeeType, item, addItem, error, totalCost, unallocDeductable, totalBenefit
6080          , payment, reserved, form, processNote, communicationRequest, insurance);
6081      }
6082
6083  @Override
6084  public ResourceType getResourceType() {
6085    return ResourceType.ClaimResponse;
6086   }
6087
6088 /**
6089   * Search parameter: <b>identifier</b>
6090   * <p>
6091   * Description: <b>The identity of the claimresponse</b><br>
6092   * Type: <b>token</b><br>
6093   * Path: <b>ClaimResponse.identifier</b><br>
6094   * </p>
6095   */
6096  @SearchParamDefinition(name="identifier", path="ClaimResponse.identifier", description="The identity of the claimresponse", type="token" )
6097  public static final String SP_IDENTIFIER = "identifier";
6098 /**
6099   * <b>Fluent Client</b> search parameter constant for <b>identifier</b>
6100   * <p>
6101   * Description: <b>The identity of the claimresponse</b><br>
6102   * Type: <b>token</b><br>
6103   * Path: <b>ClaimResponse.identifier</b><br>
6104   * </p>
6105   */
6106  public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER);
6107
6108 /**
6109   * Search parameter: <b>request</b>
6110   * <p>
6111   * Description: <b>The claim reference</b><br>
6112   * Type: <b>reference</b><br>
6113   * Path: <b>ClaimResponse.request</b><br>
6114   * </p>
6115   */
6116  @SearchParamDefinition(name="request", path="ClaimResponse.request", description="The claim reference", type="reference", target={Claim.class } )
6117  public static final String SP_REQUEST = "request";
6118 /**
6119   * <b>Fluent Client</b> search parameter constant for <b>request</b>
6120   * <p>
6121   * Description: <b>The claim reference</b><br>
6122   * Type: <b>reference</b><br>
6123   * Path: <b>ClaimResponse.request</b><br>
6124   * </p>
6125   */
6126  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST);
6127
6128/**
6129   * Constant for fluent queries to be used to add include statements. Specifies
6130   * the path value of "<b>ClaimResponse:request</b>".
6131   */
6132  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST = new ca.uhn.fhir.model.api.Include("ClaimResponse:request").toLocked();
6133
6134 /**
6135   * Search parameter: <b>disposition</b>
6136   * <p>
6137   * Description: <b>The contents of the disposition message</b><br>
6138   * Type: <b>string</b><br>
6139   * Path: <b>ClaimResponse.disposition</b><br>
6140   * </p>
6141   */
6142  @SearchParamDefinition(name="disposition", path="ClaimResponse.disposition", description="The contents of the disposition message", type="string" )
6143  public static final String SP_DISPOSITION = "disposition";
6144 /**
6145   * <b>Fluent Client</b> search parameter constant for <b>disposition</b>
6146   * <p>
6147   * Description: <b>The contents of the disposition message</b><br>
6148   * Type: <b>string</b><br>
6149   * Path: <b>ClaimResponse.disposition</b><br>
6150   * </p>
6151   */
6152  public static final ca.uhn.fhir.rest.gclient.StringClientParam DISPOSITION = new ca.uhn.fhir.rest.gclient.StringClientParam(SP_DISPOSITION);
6153
6154 /**
6155   * Search parameter: <b>insurer</b>
6156   * <p>
6157   * Description: <b>The organization who generated this resource</b><br>
6158   * Type: <b>reference</b><br>
6159   * Path: <b>ClaimResponse.insurer</b><br>
6160   * </p>
6161   */
6162  @SearchParamDefinition(name="insurer", path="ClaimResponse.insurer", description="The organization who generated this resource", type="reference", target={Organization.class } )
6163  public static final String SP_INSURER = "insurer";
6164 /**
6165   * <b>Fluent Client</b> search parameter constant for <b>insurer</b>
6166   * <p>
6167   * Description: <b>The organization who generated this resource</b><br>
6168   * Type: <b>reference</b><br>
6169   * Path: <b>ClaimResponse.insurer</b><br>
6170   * </p>
6171   */
6172  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INSURER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INSURER);
6173
6174/**
6175   * Constant for fluent queries to be used to add include statements. Specifies
6176   * the path value of "<b>ClaimResponse:insurer</b>".
6177   */
6178  public static final ca.uhn.fhir.model.api.Include INCLUDE_INSURER = new ca.uhn.fhir.model.api.Include("ClaimResponse:insurer").toLocked();
6179
6180 /**
6181   * Search parameter: <b>created</b>
6182   * <p>
6183   * Description: <b>The creation date</b><br>
6184   * Type: <b>date</b><br>
6185   * Path: <b>ClaimResponse.created</b><br>
6186   * </p>
6187   */
6188  @SearchParamDefinition(name="created", path="ClaimResponse.created", description="The creation date", type="date" )
6189  public static final String SP_CREATED = "created";
6190 /**
6191   * <b>Fluent Client</b> search parameter constant for <b>created</b>
6192   * <p>
6193   * Description: <b>The creation date</b><br>
6194   * Type: <b>date</b><br>
6195   * Path: <b>ClaimResponse.created</b><br>
6196   * </p>
6197   */
6198  public static final ca.uhn.fhir.rest.gclient.DateClientParam CREATED = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_CREATED);
6199
6200 /**
6201   * Search parameter: <b>patient</b>
6202   * <p>
6203   * Description: <b>The subject of care.</b><br>
6204   * Type: <b>reference</b><br>
6205   * Path: <b>ClaimResponse.patient</b><br>
6206   * </p>
6207   */
6208  @SearchParamDefinition(name="patient", path="ClaimResponse.patient", description="The subject of care.", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Patient.class } )
6209  public static final String SP_PATIENT = "patient";
6210 /**
6211   * <b>Fluent Client</b> search parameter constant for <b>patient</b>
6212   * <p>
6213   * Description: <b>The subject of care.</b><br>
6214   * Type: <b>reference</b><br>
6215   * Path: <b>ClaimResponse.patient</b><br>
6216   * </p>
6217   */
6218  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT);
6219
6220/**
6221   * Constant for fluent queries to be used to add include statements. Specifies
6222   * the path value of "<b>ClaimResponse:patient</b>".
6223   */
6224  public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("ClaimResponse:patient").toLocked();
6225
6226 /**
6227   * Search parameter: <b>payment-date</b>
6228   * <p>
6229   * Description: <b>The expected paymentDate</b><br>
6230   * Type: <b>date</b><br>
6231   * Path: <b>ClaimResponse.payment.date</b><br>
6232   * </p>
6233   */
6234  @SearchParamDefinition(name="payment-date", path="ClaimResponse.payment.date", description="The expected paymentDate", type="date" )
6235  public static final String SP_PAYMENT_DATE = "payment-date";
6236 /**
6237   * <b>Fluent Client</b> search parameter constant for <b>payment-date</b>
6238   * <p>
6239   * Description: <b>The expected paymentDate</b><br>
6240   * Type: <b>date</b><br>
6241   * Path: <b>ClaimResponse.payment.date</b><br>
6242   * </p>
6243   */
6244  public static final ca.uhn.fhir.rest.gclient.DateClientParam PAYMENT_DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_PAYMENT_DATE);
6245
6246 /**
6247   * Search parameter: <b>request-provider</b>
6248   * <p>
6249   * Description: <b>The Provider of the claim</b><br>
6250   * Type: <b>reference</b><br>
6251   * Path: <b>ClaimResponse.requestProvider</b><br>
6252   * </p>
6253   */
6254  @SearchParamDefinition(name="request-provider", path="ClaimResponse.requestProvider", description="The Provider of the claim", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Practitioner.class } )
6255  public static final String SP_REQUEST_PROVIDER = "request-provider";
6256 /**
6257   * <b>Fluent Client</b> search parameter constant for <b>request-provider</b>
6258   * <p>
6259   * Description: <b>The Provider of the claim</b><br>
6260   * Type: <b>reference</b><br>
6261   * Path: <b>ClaimResponse.requestProvider</b><br>
6262   * </p>
6263   */
6264  public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUEST_PROVIDER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUEST_PROVIDER);
6265
6266/**
6267   * Constant for fluent queries to be used to add include statements. Specifies
6268   * the path value of "<b>ClaimResponse:request-provider</b>".
6269   */
6270  public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUEST_PROVIDER = new ca.uhn.fhir.model.api.Include("ClaimResponse:request-provider").toLocked();
6271
6272 /**
6273   * Search parameter: <b>outcome</b>
6274   * <p>
6275   * Description: <b>The processing outcome</b><br>
6276   * Type: <b>token</b><br>
6277   * Path: <b>ClaimResponse.outcome</b><br>
6278   * </p>
6279   */
6280  @SearchParamDefinition(name="outcome", path="ClaimResponse.outcome", description="The processing outcome", type="token" )
6281  public static final String SP_OUTCOME = "outcome";
6282 /**
6283   * <b>Fluent Client</b> search parameter constant for <b>outcome</b>
6284   * <p>
6285   * Description: <b>The processing outcome</b><br>
6286   * Type: <b>token</b><br>
6287   * Path: <b>ClaimResponse.outcome</b><br>
6288   * </p>
6289   */
6290  public static final ca.uhn.fhir.rest.gclient.TokenClientParam OUTCOME = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_OUTCOME);
6291
6292
6293}
6294