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