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