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