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