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