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