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