001package org.hl7.fhir.dstu2.model;
002
003/*-
004 * #%L
005 * org.hl7.fhir.dstu2
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
024import java.math.BigDecimal;
025
026/*
027  Copyright (c) 2011+, HL7, Inc.
028  All rights reserved.
029  
030  Redistribution and use in source and binary forms, with or without modification, 
031  are permitted provided that the following conditions are met:
032  
033   * Redistributions of source code must retain the above copyright notice, this 
034     list of conditions and the following disclaimer.
035   * Redistributions in binary form must reproduce the above copyright notice, 
036     this list of conditions and the following disclaimer in the documentation 
037     and/or other materials provided with the distribution.
038   * Neither the name of HL7 nor the names of its contributors may be used to 
039     endorse or promote products derived from this software without specific 
040     prior written permission.
041  
042  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
043  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
044  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
045  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
046  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
047  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
048  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
049  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
050  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
051  POSSIBILITY OF SUCH DAMAGE.
052  
053*/
054
055// Generated on Wed, Jul 13, 2016 05:32+1000 for FHIR v1.0.2
056import java.util.ArrayList;
057import java.util.Date;
058import java.util.List;
059
060import org.hl7.fhir.dstu2.model.Enumerations.RemittanceOutcome;
061import org.hl7.fhir.dstu2.model.Enumerations.RemittanceOutcomeEnumFactory;
062import ca.uhn.fhir.model.api.annotation.Block;
063import ca.uhn.fhir.model.api.annotation.Child;
064import ca.uhn.fhir.model.api.annotation.Description;
065import ca.uhn.fhir.model.api.annotation.ResourceDef;
066import ca.uhn.fhir.model.api.annotation.SearchParamDefinition;
067import org.hl7.fhir.instance.model.api.IBaseBackboneElement;
068import org.hl7.fhir.exceptions.FHIRException;
069import org.hl7.fhir.utilities.Utilities;
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/Profile/ClaimResponse")
074public class ClaimResponse extends DomainResource {
075
076    @Block()
077    public static class ItemsComponent extends BackboneElement implements IBaseBackboneElement {
078        /**
079         * A service line number.
080         */
081        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
082        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
083        protected PositiveIntType sequenceLinkId;
084
085        /**
086         * A list of note references to the notes provided below.
087         */
088        @Child(name = "noteNumber", type = {PositiveIntType.class}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
089        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
090        protected List<PositiveIntType> noteNumber;
091
092        /**
093         * The adjudications results.
094         */
095        @Child(name = "adjudication", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
096        @Description(shortDefinition="Adjudication details", formalDefinition="The adjudications results." )
097        protected List<ItemAdjudicationComponent> adjudication;
098
099        /**
100         * The second tier service adjudications for submitted services.
101         */
102        @Child(name = "detail", type = {}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
103        @Description(shortDefinition="Detail line items", formalDefinition="The second tier service adjudications for submitted services." )
104        protected List<ItemDetailComponent> detail;
105
106        private static final long serialVersionUID = -1917866697L;
107
108    /*
109     * Constructor
110     */
111      public ItemsComponent() {
112        super();
113      }
114
115    /*
116     * Constructor
117     */
118      public ItemsComponent(PositiveIntType sequenceLinkId) {
119        super();
120        this.sequenceLinkId = sequenceLinkId;
121      }
122
123        /**
124         * @return {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
125         */
126        public PositiveIntType getSequenceLinkIdElement() { 
127          if (this.sequenceLinkId == null)
128            if (Configuration.errorOnAutoCreate())
129              throw new Error("Attempt to auto-create ItemsComponent.sequenceLinkId");
130            else if (Configuration.doAutoCreate())
131              this.sequenceLinkId = new PositiveIntType(); // bb
132          return this.sequenceLinkId;
133        }
134
135        public boolean hasSequenceLinkIdElement() { 
136          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
137        }
138
139        public boolean hasSequenceLinkId() { 
140          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
141        }
142
143        /**
144         * @param value {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
145         */
146        public ItemsComponent setSequenceLinkIdElement(PositiveIntType value) { 
147          this.sequenceLinkId = value;
148          return this;
149        }
150
151        /**
152         * @return A service line number.
153         */
154        public int getSequenceLinkId() { 
155          return this.sequenceLinkId == null || this.sequenceLinkId.isEmpty() ? 0 : this.sequenceLinkId.getValue();
156        }
157
158        /**
159         * @param value A service line number.
160         */
161        public ItemsComponent setSequenceLinkId(int value) { 
162            if (this.sequenceLinkId == null)
163              this.sequenceLinkId = new PositiveIntType();
164            this.sequenceLinkId.setValue(value);
165          return this;
166        }
167
168        /**
169         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
170         */
171        public List<PositiveIntType> getNoteNumber() { 
172          if (this.noteNumber == null)
173            this.noteNumber = new ArrayList<PositiveIntType>();
174          return this.noteNumber;
175        }
176
177        public boolean hasNoteNumber() { 
178          if (this.noteNumber == null)
179            return false;
180          for (PositiveIntType item : this.noteNumber)
181            if (!item.isEmpty())
182              return true;
183          return false;
184        }
185
186        /**
187         * @return {@link #noteNumber} (A list of note references to the notes provided below.)
188         */
189    // syntactic sugar
190        public PositiveIntType addNoteNumberElement() {//2 
191          PositiveIntType t = new PositiveIntType();
192          if (this.noteNumber == null)
193            this.noteNumber = new ArrayList<PositiveIntType>();
194          this.noteNumber.add(t);
195          return t;
196        }
197
198        /**
199         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
200         */
201        public ItemsComponent addNoteNumber(int value) { //1
202          PositiveIntType t = new PositiveIntType();
203          t.setValue(value);
204          if (this.noteNumber == null)
205            this.noteNumber = new ArrayList<PositiveIntType>();
206          this.noteNumber.add(t);
207          return this;
208        }
209
210        /**
211         * @param value {@link #noteNumber} (A list of note references to the notes provided below.)
212         */
213        public boolean hasNoteNumber(int value) { 
214          if (this.noteNumber == null)
215            return false;
216          for (PositiveIntType v : this.noteNumber)
217            if (v.equals(value)) // positiveInt
218              return true;
219          return false;
220        }
221
222        /**
223         * @return {@link #adjudication} (The adjudications results.)
224         */
225        public List<ItemAdjudicationComponent> getAdjudication() { 
226          if (this.adjudication == null)
227            this.adjudication = new ArrayList<ItemAdjudicationComponent>();
228          return this.adjudication;
229        }
230
231        public boolean hasAdjudication() { 
232          if (this.adjudication == null)
233            return false;
234          for (ItemAdjudicationComponent item : this.adjudication)
235            if (!item.isEmpty())
236              return true;
237          return false;
238        }
239
240        /**
241         * @return {@link #adjudication} (The adjudications results.)
242         */
243    // syntactic sugar
244        public ItemAdjudicationComponent addAdjudication() { //3
245          ItemAdjudicationComponent t = new ItemAdjudicationComponent();
246          if (this.adjudication == null)
247            this.adjudication = new ArrayList<ItemAdjudicationComponent>();
248          this.adjudication.add(t);
249          return t;
250        }
251
252    // syntactic sugar
253        public ItemsComponent addAdjudication(ItemAdjudicationComponent t) { //3
254          if (t == null)
255            return this;
256          if (this.adjudication == null)
257            this.adjudication = new ArrayList<ItemAdjudicationComponent>();
258          this.adjudication.add(t);
259          return this;
260        }
261
262        /**
263         * @return {@link #detail} (The second tier service adjudications for submitted services.)
264         */
265        public List<ItemDetailComponent> getDetail() { 
266          if (this.detail == null)
267            this.detail = new ArrayList<ItemDetailComponent>();
268          return this.detail;
269        }
270
271        public boolean hasDetail() { 
272          if (this.detail == null)
273            return false;
274          for (ItemDetailComponent item : this.detail)
275            if (!item.isEmpty())
276              return true;
277          return false;
278        }
279
280        /**
281         * @return {@link #detail} (The second tier service adjudications for submitted services.)
282         */
283    // syntactic sugar
284        public ItemDetailComponent addDetail() { //3
285          ItemDetailComponent t = new ItemDetailComponent();
286          if (this.detail == null)
287            this.detail = new ArrayList<ItemDetailComponent>();
288          this.detail.add(t);
289          return t;
290        }
291
292    // syntactic sugar
293        public ItemsComponent addDetail(ItemDetailComponent t) { //3
294          if (t == null)
295            return this;
296          if (this.detail == null)
297            this.detail = new ArrayList<ItemDetailComponent>();
298          this.detail.add(t);
299          return this;
300        }
301
302        protected void listChildren(List<Property> childrenList) {
303          super.listChildren(childrenList);
304          childrenList.add(new Property("sequenceLinkId", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
305          childrenList.add(new Property("noteNumber", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumber));
306          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
307          childrenList.add(new Property("detail", "", "The second tier service adjudications for submitted services.", 0, java.lang.Integer.MAX_VALUE, detail));
308        }
309
310      @Override
311      public void setProperty(String name, Base value) throws FHIRException {
312        if (name.equals("sequenceLinkId"))
313          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
314        else if (name.equals("noteNumber"))
315          this.getNoteNumber().add(castToPositiveInt(value));
316        else if (name.equals("adjudication"))
317          this.getAdjudication().add((ItemAdjudicationComponent) value);
318        else if (name.equals("detail"))
319          this.getDetail().add((ItemDetailComponent) value);
320        else
321          super.setProperty(name, value);
322      }
323
324      @Override
325      public Base addChild(String name) throws FHIRException {
326        if (name.equals("sequenceLinkId")) {
327          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
328        }
329        else if (name.equals("noteNumber")) {
330          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.noteNumber");
331        }
332        else if (name.equals("adjudication")) {
333          return addAdjudication();
334        }
335        else if (name.equals("detail")) {
336          return addDetail();
337        }
338        else
339          return super.addChild(name);
340      }
341
342      public ItemsComponent copy() {
343        ItemsComponent dst = new ItemsComponent();
344        copyValues(dst);
345        dst.sequenceLinkId = sequenceLinkId == null ? null : sequenceLinkId.copy();
346        if (noteNumber != null) {
347          dst.noteNumber = new ArrayList<PositiveIntType>();
348          for (PositiveIntType i : noteNumber)
349            dst.noteNumber.add(i.copy());
350        };
351        if (adjudication != null) {
352          dst.adjudication = new ArrayList<ItemAdjudicationComponent>();
353          for (ItemAdjudicationComponent i : adjudication)
354            dst.adjudication.add(i.copy());
355        };
356        if (detail != null) {
357          dst.detail = new ArrayList<ItemDetailComponent>();
358          for (ItemDetailComponent i : detail)
359            dst.detail.add(i.copy());
360        };
361        return dst;
362      }
363
364      @Override
365      public boolean equalsDeep(Base other) {
366        if (!super.equalsDeep(other))
367          return false;
368        if (!(other instanceof ItemsComponent))
369          return false;
370        ItemsComponent o = (ItemsComponent) other;
371        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(noteNumber, o.noteNumber, true)
372           && compareDeep(adjudication, o.adjudication, true) && compareDeep(detail, o.detail, true);
373      }
374
375      @Override
376      public boolean equalsShallow(Base other) {
377        if (!super.equalsShallow(other))
378          return false;
379        if (!(other instanceof ItemsComponent))
380          return false;
381        ItemsComponent o = (ItemsComponent) other;
382        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumber, o.noteNumber, true)
383          ;
384      }
385
386      public boolean isEmpty() {
387        return super.isEmpty() && (sequenceLinkId == null || sequenceLinkId.isEmpty()) && (noteNumber == null || noteNumber.isEmpty())
388           && (adjudication == null || adjudication.isEmpty()) && (detail == null || detail.isEmpty())
389          ;
390      }
391
392  public String fhirType() {
393    return "ClaimResponse.item";
394
395  }
396
397  }
398
399    @Block()
400    public static class ItemAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
401        /**
402         * Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.
403         */
404        @Child(name = "code", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
405        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc." )
406        protected Coding code;
407
408        /**
409         * Monetary amount associated with the code.
410         */
411        @Child(name = "amount", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
412        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the code." )
413        protected Money amount;
414
415        /**
416         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
417         */
418        @Child(name = "value", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
419        @Description(shortDefinition="Non-monetary value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
420        protected DecimalType value;
421
422        private static final long serialVersionUID = -949880587L;
423
424    /*
425     * Constructor
426     */
427      public ItemAdjudicationComponent() {
428        super();
429      }
430
431    /*
432     * Constructor
433     */
434      public ItemAdjudicationComponent(Coding code) {
435        super();
436        this.code = code;
437      }
438
439        /**
440         * @return {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
441         */
442        public Coding getCode() { 
443          if (this.code == null)
444            if (Configuration.errorOnAutoCreate())
445              throw new Error("Attempt to auto-create ItemAdjudicationComponent.code");
446            else if (Configuration.doAutoCreate())
447              this.code = new Coding(); // cc
448          return this.code;
449        }
450
451        public boolean hasCode() { 
452          return this.code != null && !this.code.isEmpty();
453        }
454
455        /**
456         * @param value {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
457         */
458        public ItemAdjudicationComponent setCode(Coding value) { 
459          this.code = value;
460          return this;
461        }
462
463        /**
464         * @return {@link #amount} (Monetary amount associated with the code.)
465         */
466        public Money getAmount() { 
467          if (this.amount == null)
468            if (Configuration.errorOnAutoCreate())
469              throw new Error("Attempt to auto-create ItemAdjudicationComponent.amount");
470            else if (Configuration.doAutoCreate())
471              this.amount = new Money(); // cc
472          return this.amount;
473        }
474
475        public boolean hasAmount() { 
476          return this.amount != null && !this.amount.isEmpty();
477        }
478
479        /**
480         * @param value {@link #amount} (Monetary amount associated with the code.)
481         */
482        public ItemAdjudicationComponent setAmount(Money value) { 
483          this.amount = value;
484          return this;
485        }
486
487        /**
488         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
489         */
490        public DecimalType getValueElement() { 
491          if (this.value == null)
492            if (Configuration.errorOnAutoCreate())
493              throw new Error("Attempt to auto-create ItemAdjudicationComponent.value");
494            else if (Configuration.doAutoCreate())
495              this.value = new DecimalType(); // bb
496          return this.value;
497        }
498
499        public boolean hasValueElement() { 
500          return this.value != null && !this.value.isEmpty();
501        }
502
503        public boolean hasValue() { 
504          return this.value != null && !this.value.isEmpty();
505        }
506
507        /**
508         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
509         */
510        public ItemAdjudicationComponent setValueElement(DecimalType value) { 
511          this.value = value;
512          return this;
513        }
514
515        /**
516         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
517         */
518        public BigDecimal getValue() { 
519          return this.value == null ? null : this.value.getValue();
520        }
521
522        /**
523         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
524         */
525        public ItemAdjudicationComponent setValue(BigDecimal value) { 
526          if (value == null)
527            this.value = null;
528          else {
529            if (this.value == null)
530              this.value = new DecimalType();
531            this.value.setValue(value);
532          }
533          return this;
534        }
535
536        protected void listChildren(List<Property> childrenList) {
537          super.listChildren(childrenList);
538          childrenList.add(new Property("code", "Coding", "Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, code));
539          childrenList.add(new Property("amount", "Money", "Monetary amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
540          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
541        }
542
543      @Override
544      public void setProperty(String name, Base value) throws FHIRException {
545        if (name.equals("code"))
546          this.code = castToCoding(value); // Coding
547        else if (name.equals("amount"))
548          this.amount = castToMoney(value); // Money
549        else if (name.equals("value"))
550          this.value = castToDecimal(value); // DecimalType
551        else
552          super.setProperty(name, value);
553      }
554
555      @Override
556      public Base addChild(String name) throws FHIRException {
557        if (name.equals("code")) {
558          this.code = new Coding();
559          return this.code;
560        }
561        else if (name.equals("amount")) {
562          this.amount = new Money();
563          return this.amount;
564        }
565        else if (name.equals("value")) {
566          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.value");
567        }
568        else
569          return super.addChild(name);
570      }
571
572      public ItemAdjudicationComponent copy() {
573        ItemAdjudicationComponent dst = new ItemAdjudicationComponent();
574        copyValues(dst);
575        dst.code = code == null ? null : code.copy();
576        dst.amount = amount == null ? null : amount.copy();
577        dst.value = value == null ? null : value.copy();
578        return dst;
579      }
580
581      @Override
582      public boolean equalsDeep(Base other) {
583        if (!super.equalsDeep(other))
584          return false;
585        if (!(other instanceof ItemAdjudicationComponent))
586          return false;
587        ItemAdjudicationComponent o = (ItemAdjudicationComponent) other;
588        return compareDeep(code, o.code, true) && compareDeep(amount, o.amount, true) && compareDeep(value, o.value, true)
589          ;
590      }
591
592      @Override
593      public boolean equalsShallow(Base other) {
594        if (!super.equalsShallow(other))
595          return false;
596        if (!(other instanceof ItemAdjudicationComponent))
597          return false;
598        ItemAdjudicationComponent o = (ItemAdjudicationComponent) other;
599        return compareValues(value, o.value, true);
600      }
601
602      public boolean isEmpty() {
603        return super.isEmpty() && (code == null || code.isEmpty()) && (amount == null || amount.isEmpty())
604           && (value == null || value.isEmpty());
605      }
606
607  public String fhirType() {
608    return "ClaimResponse.item.adjudication";
609
610  }
611
612  }
613
614    @Block()
615    public static class ItemDetailComponent extends BackboneElement implements IBaseBackboneElement {
616        /**
617         * A service line number.
618         */
619        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
620        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
621        protected PositiveIntType sequenceLinkId;
622
623        /**
624         * The adjudications results.
625         */
626        @Child(name = "adjudication", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
627        @Description(shortDefinition="Detail adjudication", formalDefinition="The adjudications results." )
628        protected List<DetailAdjudicationComponent> adjudication;
629
630        /**
631         * The third tier service adjudications for submitted services.
632         */
633        @Child(name = "subDetail", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
634        @Description(shortDefinition="Subdetail line items", formalDefinition="The third tier service adjudications for submitted services." )
635        protected List<SubDetailComponent> subDetail;
636
637        private static final long serialVersionUID = -1751018357L;
638
639    /*
640     * Constructor
641     */
642      public ItemDetailComponent() {
643        super();
644      }
645
646    /*
647     * Constructor
648     */
649      public ItemDetailComponent(PositiveIntType sequenceLinkId) {
650        super();
651        this.sequenceLinkId = sequenceLinkId;
652      }
653
654        /**
655         * @return {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
656         */
657        public PositiveIntType getSequenceLinkIdElement() { 
658          if (this.sequenceLinkId == null)
659            if (Configuration.errorOnAutoCreate())
660              throw new Error("Attempt to auto-create ItemDetailComponent.sequenceLinkId");
661            else if (Configuration.doAutoCreate())
662              this.sequenceLinkId = new PositiveIntType(); // bb
663          return this.sequenceLinkId;
664        }
665
666        public boolean hasSequenceLinkIdElement() { 
667          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
668        }
669
670        public boolean hasSequenceLinkId() { 
671          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
672        }
673
674        /**
675         * @param value {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
676         */
677        public ItemDetailComponent setSequenceLinkIdElement(PositiveIntType value) { 
678          this.sequenceLinkId = value;
679          return this;
680        }
681
682        /**
683         * @return A service line number.
684         */
685        public int getSequenceLinkId() { 
686          return this.sequenceLinkId == null || this.sequenceLinkId.isEmpty() ? 0 : this.sequenceLinkId.getValue();
687        }
688
689        /**
690         * @param value A service line number.
691         */
692        public ItemDetailComponent setSequenceLinkId(int value) { 
693            if (this.sequenceLinkId == null)
694              this.sequenceLinkId = new PositiveIntType();
695            this.sequenceLinkId.setValue(value);
696          return this;
697        }
698
699        /**
700         * @return {@link #adjudication} (The adjudications results.)
701         */
702        public List<DetailAdjudicationComponent> getAdjudication() { 
703          if (this.adjudication == null)
704            this.adjudication = new ArrayList<DetailAdjudicationComponent>();
705          return this.adjudication;
706        }
707
708        public boolean hasAdjudication() { 
709          if (this.adjudication == null)
710            return false;
711          for (DetailAdjudicationComponent item : this.adjudication)
712            if (!item.isEmpty())
713              return true;
714          return false;
715        }
716
717        /**
718         * @return {@link #adjudication} (The adjudications results.)
719         */
720    // syntactic sugar
721        public DetailAdjudicationComponent addAdjudication() { //3
722          DetailAdjudicationComponent t = new DetailAdjudicationComponent();
723          if (this.adjudication == null)
724            this.adjudication = new ArrayList<DetailAdjudicationComponent>();
725          this.adjudication.add(t);
726          return t;
727        }
728
729    // syntactic sugar
730        public ItemDetailComponent addAdjudication(DetailAdjudicationComponent t) { //3
731          if (t == null)
732            return this;
733          if (this.adjudication == null)
734            this.adjudication = new ArrayList<DetailAdjudicationComponent>();
735          this.adjudication.add(t);
736          return this;
737        }
738
739        /**
740         * @return {@link #subDetail} (The third tier service adjudications for submitted services.)
741         */
742        public List<SubDetailComponent> getSubDetail() { 
743          if (this.subDetail == null)
744            this.subDetail = new ArrayList<SubDetailComponent>();
745          return this.subDetail;
746        }
747
748        public boolean hasSubDetail() { 
749          if (this.subDetail == null)
750            return false;
751          for (SubDetailComponent item : this.subDetail)
752            if (!item.isEmpty())
753              return true;
754          return false;
755        }
756
757        /**
758         * @return {@link #subDetail} (The third tier service adjudications for submitted services.)
759         */
760    // syntactic sugar
761        public SubDetailComponent addSubDetail() { //3
762          SubDetailComponent t = new SubDetailComponent();
763          if (this.subDetail == null)
764            this.subDetail = new ArrayList<SubDetailComponent>();
765          this.subDetail.add(t);
766          return t;
767        }
768
769    // syntactic sugar
770        public ItemDetailComponent addSubDetail(SubDetailComponent t) { //3
771          if (t == null)
772            return this;
773          if (this.subDetail == null)
774            this.subDetail = new ArrayList<SubDetailComponent>();
775          this.subDetail.add(t);
776          return this;
777        }
778
779        protected void listChildren(List<Property> childrenList) {
780          super.listChildren(childrenList);
781          childrenList.add(new Property("sequenceLinkId", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
782          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
783          childrenList.add(new Property("subDetail", "", "The third tier service adjudications for submitted services.", 0, java.lang.Integer.MAX_VALUE, subDetail));
784        }
785
786      @Override
787      public void setProperty(String name, Base value) throws FHIRException {
788        if (name.equals("sequenceLinkId"))
789          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
790        else if (name.equals("adjudication"))
791          this.getAdjudication().add((DetailAdjudicationComponent) value);
792        else if (name.equals("subDetail"))
793          this.getSubDetail().add((SubDetailComponent) value);
794        else
795          super.setProperty(name, value);
796      }
797
798      @Override
799      public Base addChild(String name) throws FHIRException {
800        if (name.equals("sequenceLinkId")) {
801          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
802        }
803        else if (name.equals("adjudication")) {
804          return addAdjudication();
805        }
806        else if (name.equals("subDetail")) {
807          return addSubDetail();
808        }
809        else
810          return super.addChild(name);
811      }
812
813      public ItemDetailComponent copy() {
814        ItemDetailComponent dst = new ItemDetailComponent();
815        copyValues(dst);
816        dst.sequenceLinkId = sequenceLinkId == null ? null : sequenceLinkId.copy();
817        if (adjudication != null) {
818          dst.adjudication = new ArrayList<DetailAdjudicationComponent>();
819          for (DetailAdjudicationComponent i : adjudication)
820            dst.adjudication.add(i.copy());
821        };
822        if (subDetail != null) {
823          dst.subDetail = new ArrayList<SubDetailComponent>();
824          for (SubDetailComponent i : subDetail)
825            dst.subDetail.add(i.copy());
826        };
827        return dst;
828      }
829
830      @Override
831      public boolean equalsDeep(Base other) {
832        if (!super.equalsDeep(other))
833          return false;
834        if (!(other instanceof ItemDetailComponent))
835          return false;
836        ItemDetailComponent o = (ItemDetailComponent) other;
837        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(adjudication, o.adjudication, true)
838           && compareDeep(subDetail, o.subDetail, true);
839      }
840
841      @Override
842      public boolean equalsShallow(Base other) {
843        if (!super.equalsShallow(other))
844          return false;
845        if (!(other instanceof ItemDetailComponent))
846          return false;
847        ItemDetailComponent o = (ItemDetailComponent) other;
848        return compareValues(sequenceLinkId, o.sequenceLinkId, true);
849      }
850
851      public boolean isEmpty() {
852        return super.isEmpty() && (sequenceLinkId == null || sequenceLinkId.isEmpty()) && (adjudication == null || adjudication.isEmpty())
853           && (subDetail == null || subDetail.isEmpty());
854      }
855
856  public String fhirType() {
857    return "ClaimResponse.item.detail";
858
859  }
860
861  }
862
863    @Block()
864    public static class DetailAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
865        /**
866         * Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.
867         */
868        @Child(name = "code", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
869        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc." )
870        protected Coding code;
871
872        /**
873         * Monetary amount associated with the code.
874         */
875        @Child(name = "amount", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
876        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the code." )
877        protected Money amount;
878
879        /**
880         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
881         */
882        @Child(name = "value", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
883        @Description(shortDefinition="Non-monetary value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
884        protected DecimalType value;
885
886        private static final long serialVersionUID = -949880587L;
887
888    /*
889     * Constructor
890     */
891      public DetailAdjudicationComponent() {
892        super();
893      }
894
895    /*
896     * Constructor
897     */
898      public DetailAdjudicationComponent(Coding code) {
899        super();
900        this.code = code;
901      }
902
903        /**
904         * @return {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
905         */
906        public Coding getCode() { 
907          if (this.code == null)
908            if (Configuration.errorOnAutoCreate())
909              throw new Error("Attempt to auto-create DetailAdjudicationComponent.code");
910            else if (Configuration.doAutoCreate())
911              this.code = new Coding(); // cc
912          return this.code;
913        }
914
915        public boolean hasCode() { 
916          return this.code != null && !this.code.isEmpty();
917        }
918
919        /**
920         * @param value {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
921         */
922        public DetailAdjudicationComponent setCode(Coding value) { 
923          this.code = value;
924          return this;
925        }
926
927        /**
928         * @return {@link #amount} (Monetary amount associated with the code.)
929         */
930        public Money getAmount() { 
931          if (this.amount == null)
932            if (Configuration.errorOnAutoCreate())
933              throw new Error("Attempt to auto-create DetailAdjudicationComponent.amount");
934            else if (Configuration.doAutoCreate())
935              this.amount = new Money(); // cc
936          return this.amount;
937        }
938
939        public boolean hasAmount() { 
940          return this.amount != null && !this.amount.isEmpty();
941        }
942
943        /**
944         * @param value {@link #amount} (Monetary amount associated with the code.)
945         */
946        public DetailAdjudicationComponent setAmount(Money value) { 
947          this.amount = value;
948          return this;
949        }
950
951        /**
952         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
953         */
954        public DecimalType getValueElement() { 
955          if (this.value == null)
956            if (Configuration.errorOnAutoCreate())
957              throw new Error("Attempt to auto-create DetailAdjudicationComponent.value");
958            else if (Configuration.doAutoCreate())
959              this.value = new DecimalType(); // bb
960          return this.value;
961        }
962
963        public boolean hasValueElement() { 
964          return this.value != null && !this.value.isEmpty();
965        }
966
967        public boolean hasValue() { 
968          return this.value != null && !this.value.isEmpty();
969        }
970
971        /**
972         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
973         */
974        public DetailAdjudicationComponent setValueElement(DecimalType value) { 
975          this.value = value;
976          return this;
977        }
978
979        /**
980         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
981         */
982        public BigDecimal getValue() { 
983          return this.value == null ? null : this.value.getValue();
984        }
985
986        /**
987         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
988         */
989        public DetailAdjudicationComponent setValue(BigDecimal value) { 
990          if (value == null)
991            this.value = null;
992          else {
993            if (this.value == null)
994              this.value = new DecimalType();
995            this.value.setValue(value);
996          }
997          return this;
998        }
999
1000        protected void listChildren(List<Property> childrenList) {
1001          super.listChildren(childrenList);
1002          childrenList.add(new Property("code", "Coding", "Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, code));
1003          childrenList.add(new Property("amount", "Money", "Monetary amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
1004          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
1005        }
1006
1007      @Override
1008      public void setProperty(String name, Base value) throws FHIRException {
1009        if (name.equals("code"))
1010          this.code = castToCoding(value); // Coding
1011        else if (name.equals("amount"))
1012          this.amount = castToMoney(value); // Money
1013        else if (name.equals("value"))
1014          this.value = castToDecimal(value); // DecimalType
1015        else
1016          super.setProperty(name, value);
1017      }
1018
1019      @Override
1020      public Base addChild(String name) throws FHIRException {
1021        if (name.equals("code")) {
1022          this.code = new Coding();
1023          return this.code;
1024        }
1025        else if (name.equals("amount")) {
1026          this.amount = new Money();
1027          return this.amount;
1028        }
1029        else if (name.equals("value")) {
1030          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.value");
1031        }
1032        else
1033          return super.addChild(name);
1034      }
1035
1036      public DetailAdjudicationComponent copy() {
1037        DetailAdjudicationComponent dst = new DetailAdjudicationComponent();
1038        copyValues(dst);
1039        dst.code = code == null ? null : code.copy();
1040        dst.amount = amount == null ? null : amount.copy();
1041        dst.value = value == null ? null : value.copy();
1042        return dst;
1043      }
1044
1045      @Override
1046      public boolean equalsDeep(Base other) {
1047        if (!super.equalsDeep(other))
1048          return false;
1049        if (!(other instanceof DetailAdjudicationComponent))
1050          return false;
1051        DetailAdjudicationComponent o = (DetailAdjudicationComponent) other;
1052        return compareDeep(code, o.code, true) && compareDeep(amount, o.amount, true) && compareDeep(value, o.value, true)
1053          ;
1054      }
1055
1056      @Override
1057      public boolean equalsShallow(Base other) {
1058        if (!super.equalsShallow(other))
1059          return false;
1060        if (!(other instanceof DetailAdjudicationComponent))
1061          return false;
1062        DetailAdjudicationComponent o = (DetailAdjudicationComponent) other;
1063        return compareValues(value, o.value, true);
1064      }
1065
1066      public boolean isEmpty() {
1067        return super.isEmpty() && (code == null || code.isEmpty()) && (amount == null || amount.isEmpty())
1068           && (value == null || value.isEmpty());
1069      }
1070
1071  public String fhirType() {
1072    return "ClaimResponse.item.detail.adjudication";
1073
1074  }
1075
1076  }
1077
1078    @Block()
1079    public static class SubDetailComponent extends BackboneElement implements IBaseBackboneElement {
1080        /**
1081         * A service line number.
1082         */
1083        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
1084        @Description(shortDefinition="Service instance", formalDefinition="A service line number." )
1085        protected PositiveIntType sequenceLinkId;
1086
1087        /**
1088         * The adjudications results.
1089         */
1090        @Child(name = "adjudication", type = {}, order=2, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1091        @Description(shortDefinition="Subdetail adjudication", formalDefinition="The adjudications results." )
1092        protected List<SubdetailAdjudicationComponent> adjudication;
1093
1094        private static final long serialVersionUID = 1780202110L;
1095
1096    /*
1097     * Constructor
1098     */
1099      public SubDetailComponent() {
1100        super();
1101      }
1102
1103    /*
1104     * Constructor
1105     */
1106      public SubDetailComponent(PositiveIntType sequenceLinkId) {
1107        super();
1108        this.sequenceLinkId = sequenceLinkId;
1109      }
1110
1111        /**
1112         * @return {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
1113         */
1114        public PositiveIntType getSequenceLinkIdElement() { 
1115          if (this.sequenceLinkId == null)
1116            if (Configuration.errorOnAutoCreate())
1117              throw new Error("Attempt to auto-create SubDetailComponent.sequenceLinkId");
1118            else if (Configuration.doAutoCreate())
1119              this.sequenceLinkId = new PositiveIntType(); // bb
1120          return this.sequenceLinkId;
1121        }
1122
1123        public boolean hasSequenceLinkIdElement() { 
1124          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
1125        }
1126
1127        public boolean hasSequenceLinkId() { 
1128          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
1129        }
1130
1131        /**
1132         * @param value {@link #sequenceLinkId} (A service line number.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
1133         */
1134        public SubDetailComponent setSequenceLinkIdElement(PositiveIntType value) { 
1135          this.sequenceLinkId = value;
1136          return this;
1137        }
1138
1139        /**
1140         * @return A service line number.
1141         */
1142        public int getSequenceLinkId() { 
1143          return this.sequenceLinkId == null || this.sequenceLinkId.isEmpty() ? 0 : this.sequenceLinkId.getValue();
1144        }
1145
1146        /**
1147         * @param value A service line number.
1148         */
1149        public SubDetailComponent setSequenceLinkId(int value) { 
1150            if (this.sequenceLinkId == null)
1151              this.sequenceLinkId = new PositiveIntType();
1152            this.sequenceLinkId.setValue(value);
1153          return this;
1154        }
1155
1156        /**
1157         * @return {@link #adjudication} (The adjudications results.)
1158         */
1159        public List<SubdetailAdjudicationComponent> getAdjudication() { 
1160          if (this.adjudication == null)
1161            this.adjudication = new ArrayList<SubdetailAdjudicationComponent>();
1162          return this.adjudication;
1163        }
1164
1165        public boolean hasAdjudication() { 
1166          if (this.adjudication == null)
1167            return false;
1168          for (SubdetailAdjudicationComponent item : this.adjudication)
1169            if (!item.isEmpty())
1170              return true;
1171          return false;
1172        }
1173
1174        /**
1175         * @return {@link #adjudication} (The adjudications results.)
1176         */
1177    // syntactic sugar
1178        public SubdetailAdjudicationComponent addAdjudication() { //3
1179          SubdetailAdjudicationComponent t = new SubdetailAdjudicationComponent();
1180          if (this.adjudication == null)
1181            this.adjudication = new ArrayList<SubdetailAdjudicationComponent>();
1182          this.adjudication.add(t);
1183          return t;
1184        }
1185
1186    // syntactic sugar
1187        public SubDetailComponent addAdjudication(SubdetailAdjudicationComponent t) { //3
1188          if (t == null)
1189            return this;
1190          if (this.adjudication == null)
1191            this.adjudication = new ArrayList<SubdetailAdjudicationComponent>();
1192          this.adjudication.add(t);
1193          return this;
1194        }
1195
1196        protected void listChildren(List<Property> childrenList) {
1197          super.listChildren(childrenList);
1198          childrenList.add(new Property("sequenceLinkId", "positiveInt", "A service line number.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
1199          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
1200        }
1201
1202      @Override
1203      public void setProperty(String name, Base value) throws FHIRException {
1204        if (name.equals("sequenceLinkId"))
1205          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
1206        else if (name.equals("adjudication"))
1207          this.getAdjudication().add((SubdetailAdjudicationComponent) value);
1208        else
1209          super.setProperty(name, value);
1210      }
1211
1212      @Override
1213      public Base addChild(String name) throws FHIRException {
1214        if (name.equals("sequenceLinkId")) {
1215          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
1216        }
1217        else if (name.equals("adjudication")) {
1218          return addAdjudication();
1219        }
1220        else
1221          return super.addChild(name);
1222      }
1223
1224      public SubDetailComponent copy() {
1225        SubDetailComponent dst = new SubDetailComponent();
1226        copyValues(dst);
1227        dst.sequenceLinkId = sequenceLinkId == null ? null : sequenceLinkId.copy();
1228        if (adjudication != null) {
1229          dst.adjudication = new ArrayList<SubdetailAdjudicationComponent>();
1230          for (SubdetailAdjudicationComponent i : adjudication)
1231            dst.adjudication.add(i.copy());
1232        };
1233        return dst;
1234      }
1235
1236      @Override
1237      public boolean equalsDeep(Base other) {
1238        if (!super.equalsDeep(other))
1239          return false;
1240        if (!(other instanceof SubDetailComponent))
1241          return false;
1242        SubDetailComponent o = (SubDetailComponent) other;
1243        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(adjudication, o.adjudication, true)
1244          ;
1245      }
1246
1247      @Override
1248      public boolean equalsShallow(Base other) {
1249        if (!super.equalsShallow(other))
1250          return false;
1251        if (!(other instanceof SubDetailComponent))
1252          return false;
1253        SubDetailComponent o = (SubDetailComponent) other;
1254        return compareValues(sequenceLinkId, o.sequenceLinkId, true);
1255      }
1256
1257      public boolean isEmpty() {
1258        return super.isEmpty() && (sequenceLinkId == null || sequenceLinkId.isEmpty()) && (adjudication == null || adjudication.isEmpty())
1259          ;
1260      }
1261
1262  public String fhirType() {
1263    return "ClaimResponse.item.detail.subDetail";
1264
1265  }
1266
1267  }
1268
1269    @Block()
1270    public static class SubdetailAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
1271        /**
1272         * Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.
1273         */
1274        @Child(name = "code", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
1275        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc." )
1276        protected Coding code;
1277
1278        /**
1279         * Monetary amount associated with the code.
1280         */
1281        @Child(name = "amount", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
1282        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the code." )
1283        protected Money amount;
1284
1285        /**
1286         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
1287         */
1288        @Child(name = "value", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1289        @Description(shortDefinition="Non-monetary value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
1290        protected DecimalType value;
1291
1292        private static final long serialVersionUID = -949880587L;
1293
1294    /*
1295     * Constructor
1296     */
1297      public SubdetailAdjudicationComponent() {
1298        super();
1299      }
1300
1301    /*
1302     * Constructor
1303     */
1304      public SubdetailAdjudicationComponent(Coding code) {
1305        super();
1306        this.code = code;
1307      }
1308
1309        /**
1310         * @return {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
1311         */
1312        public Coding getCode() { 
1313          if (this.code == null)
1314            if (Configuration.errorOnAutoCreate())
1315              throw new Error("Attempt to auto-create SubdetailAdjudicationComponent.code");
1316            else if (Configuration.doAutoCreate())
1317              this.code = new Coding(); // cc
1318          return this.code;
1319        }
1320
1321        public boolean hasCode() { 
1322          return this.code != null && !this.code.isEmpty();
1323        }
1324
1325        /**
1326         * @param value {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
1327         */
1328        public SubdetailAdjudicationComponent setCode(Coding value) { 
1329          this.code = value;
1330          return this;
1331        }
1332
1333        /**
1334         * @return {@link #amount} (Monetary amount associated with the code.)
1335         */
1336        public Money getAmount() { 
1337          if (this.amount == null)
1338            if (Configuration.errorOnAutoCreate())
1339              throw new Error("Attempt to auto-create SubdetailAdjudicationComponent.amount");
1340            else if (Configuration.doAutoCreate())
1341              this.amount = new Money(); // cc
1342          return this.amount;
1343        }
1344
1345        public boolean hasAmount() { 
1346          return this.amount != null && !this.amount.isEmpty();
1347        }
1348
1349        /**
1350         * @param value {@link #amount} (Monetary amount associated with the code.)
1351         */
1352        public SubdetailAdjudicationComponent setAmount(Money value) { 
1353          this.amount = value;
1354          return this;
1355        }
1356
1357        /**
1358         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1359         */
1360        public DecimalType getValueElement() { 
1361          if (this.value == null)
1362            if (Configuration.errorOnAutoCreate())
1363              throw new Error("Attempt to auto-create SubdetailAdjudicationComponent.value");
1364            else if (Configuration.doAutoCreate())
1365              this.value = new DecimalType(); // bb
1366          return this.value;
1367        }
1368
1369        public boolean hasValueElement() { 
1370          return this.value != null && !this.value.isEmpty();
1371        }
1372
1373        public boolean hasValue() { 
1374          return this.value != null && !this.value.isEmpty();
1375        }
1376
1377        /**
1378         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1379         */
1380        public SubdetailAdjudicationComponent setValueElement(DecimalType value) { 
1381          this.value = value;
1382          return this;
1383        }
1384
1385        /**
1386         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
1387         */
1388        public BigDecimal getValue() { 
1389          return this.value == null ? null : this.value.getValue();
1390        }
1391
1392        /**
1393         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
1394         */
1395        public SubdetailAdjudicationComponent setValue(BigDecimal value) { 
1396          if (value == null)
1397            this.value = null;
1398          else {
1399            if (this.value == null)
1400              this.value = new DecimalType();
1401            this.value.setValue(value);
1402          }
1403          return this;
1404        }
1405
1406        protected void listChildren(List<Property> childrenList) {
1407          super.listChildren(childrenList);
1408          childrenList.add(new Property("code", "Coding", "Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, code));
1409          childrenList.add(new Property("amount", "Money", "Monetary amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
1410          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
1411        }
1412
1413      @Override
1414      public void setProperty(String name, Base value) throws FHIRException {
1415        if (name.equals("code"))
1416          this.code = castToCoding(value); // Coding
1417        else if (name.equals("amount"))
1418          this.amount = castToMoney(value); // Money
1419        else if (name.equals("value"))
1420          this.value = castToDecimal(value); // DecimalType
1421        else
1422          super.setProperty(name, value);
1423      }
1424
1425      @Override
1426      public Base addChild(String name) throws FHIRException {
1427        if (name.equals("code")) {
1428          this.code = new Coding();
1429          return this.code;
1430        }
1431        else if (name.equals("amount")) {
1432          this.amount = new Money();
1433          return this.amount;
1434        }
1435        else if (name.equals("value")) {
1436          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.value");
1437        }
1438        else
1439          return super.addChild(name);
1440      }
1441
1442      public SubdetailAdjudicationComponent copy() {
1443        SubdetailAdjudicationComponent dst = new SubdetailAdjudicationComponent();
1444        copyValues(dst);
1445        dst.code = code == null ? null : code.copy();
1446        dst.amount = amount == null ? null : amount.copy();
1447        dst.value = value == null ? null : value.copy();
1448        return dst;
1449      }
1450
1451      @Override
1452      public boolean equalsDeep(Base other) {
1453        if (!super.equalsDeep(other))
1454          return false;
1455        if (!(other instanceof SubdetailAdjudicationComponent))
1456          return false;
1457        SubdetailAdjudicationComponent o = (SubdetailAdjudicationComponent) other;
1458        return compareDeep(code, o.code, true) && compareDeep(amount, o.amount, true) && compareDeep(value, o.value, true)
1459          ;
1460      }
1461
1462      @Override
1463      public boolean equalsShallow(Base other) {
1464        if (!super.equalsShallow(other))
1465          return false;
1466        if (!(other instanceof SubdetailAdjudicationComponent))
1467          return false;
1468        SubdetailAdjudicationComponent o = (SubdetailAdjudicationComponent) other;
1469        return compareValues(value, o.value, true);
1470      }
1471
1472      public boolean isEmpty() {
1473        return super.isEmpty() && (code == null || code.isEmpty()) && (amount == null || amount.isEmpty())
1474           && (value == null || value.isEmpty());
1475      }
1476
1477  public String fhirType() {
1478    return "ClaimResponse.item.detail.subDetail.adjudication";
1479
1480  }
1481
1482  }
1483
1484    @Block()
1485    public static class AddedItemComponent extends BackboneElement implements IBaseBackboneElement {
1486        /**
1487         * List of input service items which this service line is intended to replace.
1488         */
1489        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1490        @Description(shortDefinition="Service instances", formalDefinition="List of input service items which this service line is intended to replace." )
1491        protected List<PositiveIntType> sequenceLinkId;
1492
1493        /**
1494         * A code to indicate the Professional Service or Product supplied.
1495         */
1496        @Child(name = "service", type = {Coding.class}, order=2, min=1, max=1, modifier=false, summary=true)
1497        @Description(shortDefinition="Group, Service or Product", formalDefinition="A code to indicate the Professional Service or Product supplied." )
1498        protected Coding service;
1499
1500        /**
1501         * The fee charged for the professional service or product..
1502         */
1503        @Child(name = "fee", type = {Money.class}, order=3, min=0, max=1, modifier=false, summary=true)
1504        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product.." )
1505        protected Money fee;
1506
1507        /**
1508         * A list of note references to the notes provided below.
1509         */
1510        @Child(name = "noteNumberLinkId", type = {PositiveIntType.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1511        @Description(shortDefinition="List of note numbers which apply", formalDefinition="A list of note references to the notes provided below." )
1512        protected List<PositiveIntType> noteNumberLinkId;
1513
1514        /**
1515         * The adjudications results.
1516         */
1517        @Child(name = "adjudication", type = {}, order=5, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1518        @Description(shortDefinition="Added items adjudication", formalDefinition="The adjudications results." )
1519        protected List<AddedItemAdjudicationComponent> adjudication;
1520
1521        /**
1522         * The second tier service adjudications for payor added services.
1523         */
1524        @Child(name = "detail", type = {}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
1525        @Description(shortDefinition="Added items details", formalDefinition="The second tier service adjudications for payor added services." )
1526        protected List<AddedItemsDetailComponent> detail;
1527
1528        private static final long serialVersionUID = -1675935854L;
1529
1530    /*
1531     * Constructor
1532     */
1533      public AddedItemComponent() {
1534        super();
1535      }
1536
1537    /*
1538     * Constructor
1539     */
1540      public AddedItemComponent(Coding service) {
1541        super();
1542        this.service = service;
1543      }
1544
1545        /**
1546         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
1547         */
1548        public List<PositiveIntType> getSequenceLinkId() { 
1549          if (this.sequenceLinkId == null)
1550            this.sequenceLinkId = new ArrayList<PositiveIntType>();
1551          return this.sequenceLinkId;
1552        }
1553
1554        public boolean hasSequenceLinkId() { 
1555          if (this.sequenceLinkId == null)
1556            return false;
1557          for (PositiveIntType item : this.sequenceLinkId)
1558            if (!item.isEmpty())
1559              return true;
1560          return false;
1561        }
1562
1563        /**
1564         * @return {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
1565         */
1566    // syntactic sugar
1567        public PositiveIntType addSequenceLinkIdElement() {//2 
1568          PositiveIntType t = new PositiveIntType();
1569          if (this.sequenceLinkId == null)
1570            this.sequenceLinkId = new ArrayList<PositiveIntType>();
1571          this.sequenceLinkId.add(t);
1572          return t;
1573        }
1574
1575        /**
1576         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
1577         */
1578        public AddedItemComponent addSequenceLinkId(int value) { //1
1579          PositiveIntType t = new PositiveIntType();
1580          t.setValue(value);
1581          if (this.sequenceLinkId == null)
1582            this.sequenceLinkId = new ArrayList<PositiveIntType>();
1583          this.sequenceLinkId.add(t);
1584          return this;
1585        }
1586
1587        /**
1588         * @param value {@link #sequenceLinkId} (List of input service items which this service line is intended to replace.)
1589         */
1590        public boolean hasSequenceLinkId(int value) { 
1591          if (this.sequenceLinkId == null)
1592            return false;
1593          for (PositiveIntType v : this.sequenceLinkId)
1594            if (v.equals(value)) // positiveInt
1595              return true;
1596          return false;
1597        }
1598
1599        /**
1600         * @return {@link #service} (A code to indicate the Professional Service or Product supplied.)
1601         */
1602        public Coding getService() { 
1603          if (this.service == null)
1604            if (Configuration.errorOnAutoCreate())
1605              throw new Error("Attempt to auto-create AddedItemComponent.service");
1606            else if (Configuration.doAutoCreate())
1607              this.service = new Coding(); // cc
1608          return this.service;
1609        }
1610
1611        public boolean hasService() { 
1612          return this.service != null && !this.service.isEmpty();
1613        }
1614
1615        /**
1616         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied.)
1617         */
1618        public AddedItemComponent setService(Coding value) { 
1619          this.service = value;
1620          return this;
1621        }
1622
1623        /**
1624         * @return {@link #fee} (The fee charged for the professional service or product..)
1625         */
1626        public Money getFee() { 
1627          if (this.fee == null)
1628            if (Configuration.errorOnAutoCreate())
1629              throw new Error("Attempt to auto-create AddedItemComponent.fee");
1630            else if (Configuration.doAutoCreate())
1631              this.fee = new Money(); // cc
1632          return this.fee;
1633        }
1634
1635        public boolean hasFee() { 
1636          return this.fee != null && !this.fee.isEmpty();
1637        }
1638
1639        /**
1640         * @param value {@link #fee} (The fee charged for the professional service or product..)
1641         */
1642        public AddedItemComponent setFee(Money value) { 
1643          this.fee = value;
1644          return this;
1645        }
1646
1647        /**
1648         * @return {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
1649         */
1650        public List<PositiveIntType> getNoteNumberLinkId() { 
1651          if (this.noteNumberLinkId == null)
1652            this.noteNumberLinkId = new ArrayList<PositiveIntType>();
1653          return this.noteNumberLinkId;
1654        }
1655
1656        public boolean hasNoteNumberLinkId() { 
1657          if (this.noteNumberLinkId == null)
1658            return false;
1659          for (PositiveIntType item : this.noteNumberLinkId)
1660            if (!item.isEmpty())
1661              return true;
1662          return false;
1663        }
1664
1665        /**
1666         * @return {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
1667         */
1668    // syntactic sugar
1669        public PositiveIntType addNoteNumberLinkIdElement() {//2 
1670          PositiveIntType t = new PositiveIntType();
1671          if (this.noteNumberLinkId == null)
1672            this.noteNumberLinkId = new ArrayList<PositiveIntType>();
1673          this.noteNumberLinkId.add(t);
1674          return t;
1675        }
1676
1677        /**
1678         * @param value {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
1679         */
1680        public AddedItemComponent addNoteNumberLinkId(int value) { //1
1681          PositiveIntType t = new PositiveIntType();
1682          t.setValue(value);
1683          if (this.noteNumberLinkId == null)
1684            this.noteNumberLinkId = new ArrayList<PositiveIntType>();
1685          this.noteNumberLinkId.add(t);
1686          return this;
1687        }
1688
1689        /**
1690         * @param value {@link #noteNumberLinkId} (A list of note references to the notes provided below.)
1691         */
1692        public boolean hasNoteNumberLinkId(int value) { 
1693          if (this.noteNumberLinkId == null)
1694            return false;
1695          for (PositiveIntType v : this.noteNumberLinkId)
1696            if (v.equals(value)) // positiveInt
1697              return true;
1698          return false;
1699        }
1700
1701        /**
1702         * @return {@link #adjudication} (The adjudications results.)
1703         */
1704        public List<AddedItemAdjudicationComponent> getAdjudication() { 
1705          if (this.adjudication == null)
1706            this.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
1707          return this.adjudication;
1708        }
1709
1710        public boolean hasAdjudication() { 
1711          if (this.adjudication == null)
1712            return false;
1713          for (AddedItemAdjudicationComponent item : this.adjudication)
1714            if (!item.isEmpty())
1715              return true;
1716          return false;
1717        }
1718
1719        /**
1720         * @return {@link #adjudication} (The adjudications results.)
1721         */
1722    // syntactic sugar
1723        public AddedItemAdjudicationComponent addAdjudication() { //3
1724          AddedItemAdjudicationComponent t = new AddedItemAdjudicationComponent();
1725          if (this.adjudication == null)
1726            this.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
1727          this.adjudication.add(t);
1728          return t;
1729        }
1730
1731    // syntactic sugar
1732        public AddedItemComponent addAdjudication(AddedItemAdjudicationComponent t) { //3
1733          if (t == null)
1734            return this;
1735          if (this.adjudication == null)
1736            this.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
1737          this.adjudication.add(t);
1738          return this;
1739        }
1740
1741        /**
1742         * @return {@link #detail} (The second tier service adjudications for payor added services.)
1743         */
1744        public List<AddedItemsDetailComponent> getDetail() { 
1745          if (this.detail == null)
1746            this.detail = new ArrayList<AddedItemsDetailComponent>();
1747          return this.detail;
1748        }
1749
1750        public boolean hasDetail() { 
1751          if (this.detail == null)
1752            return false;
1753          for (AddedItemsDetailComponent item : this.detail)
1754            if (!item.isEmpty())
1755              return true;
1756          return false;
1757        }
1758
1759        /**
1760         * @return {@link #detail} (The second tier service adjudications for payor added services.)
1761         */
1762    // syntactic sugar
1763        public AddedItemsDetailComponent addDetail() { //3
1764          AddedItemsDetailComponent t = new AddedItemsDetailComponent();
1765          if (this.detail == null)
1766            this.detail = new ArrayList<AddedItemsDetailComponent>();
1767          this.detail.add(t);
1768          return t;
1769        }
1770
1771    // syntactic sugar
1772        public AddedItemComponent addDetail(AddedItemsDetailComponent t) { //3
1773          if (t == null)
1774            return this;
1775          if (this.detail == null)
1776            this.detail = new ArrayList<AddedItemsDetailComponent>();
1777          this.detail.add(t);
1778          return this;
1779        }
1780
1781        protected void listChildren(List<Property> childrenList) {
1782          super.listChildren(childrenList);
1783          childrenList.add(new Property("sequenceLinkId", "positiveInt", "List of input service items which this service line is intended to replace.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
1784          childrenList.add(new Property("service", "Coding", "A code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
1785          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product..", 0, java.lang.Integer.MAX_VALUE, fee));
1786          childrenList.add(new Property("noteNumberLinkId", "positiveInt", "A list of note references to the notes provided below.", 0, java.lang.Integer.MAX_VALUE, noteNumberLinkId));
1787          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
1788          childrenList.add(new Property("detail", "", "The second tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, detail));
1789        }
1790
1791      @Override
1792      public void setProperty(String name, Base value) throws FHIRException {
1793        if (name.equals("sequenceLinkId"))
1794          this.getSequenceLinkId().add(castToPositiveInt(value));
1795        else if (name.equals("service"))
1796          this.service = castToCoding(value); // Coding
1797        else if (name.equals("fee"))
1798          this.fee = castToMoney(value); // Money
1799        else if (name.equals("noteNumberLinkId"))
1800          this.getNoteNumberLinkId().add(castToPositiveInt(value));
1801        else if (name.equals("adjudication"))
1802          this.getAdjudication().add((AddedItemAdjudicationComponent) value);
1803        else if (name.equals("detail"))
1804          this.getDetail().add((AddedItemsDetailComponent) value);
1805        else
1806          super.setProperty(name, value);
1807      }
1808
1809      @Override
1810      public Base addChild(String name) throws FHIRException {
1811        if (name.equals("sequenceLinkId")) {
1812          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
1813        }
1814        else if (name.equals("service")) {
1815          this.service = new Coding();
1816          return this.service;
1817        }
1818        else if (name.equals("fee")) {
1819          this.fee = new Money();
1820          return this.fee;
1821        }
1822        else if (name.equals("noteNumberLinkId")) {
1823          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.noteNumberLinkId");
1824        }
1825        else if (name.equals("adjudication")) {
1826          return addAdjudication();
1827        }
1828        else if (name.equals("detail")) {
1829          return addDetail();
1830        }
1831        else
1832          return super.addChild(name);
1833      }
1834
1835      public AddedItemComponent copy() {
1836        AddedItemComponent dst = new AddedItemComponent();
1837        copyValues(dst);
1838        if (sequenceLinkId != null) {
1839          dst.sequenceLinkId = new ArrayList<PositiveIntType>();
1840          for (PositiveIntType i : sequenceLinkId)
1841            dst.sequenceLinkId.add(i.copy());
1842        };
1843        dst.service = service == null ? null : service.copy();
1844        dst.fee = fee == null ? null : fee.copy();
1845        if (noteNumberLinkId != null) {
1846          dst.noteNumberLinkId = new ArrayList<PositiveIntType>();
1847          for (PositiveIntType i : noteNumberLinkId)
1848            dst.noteNumberLinkId.add(i.copy());
1849        };
1850        if (adjudication != null) {
1851          dst.adjudication = new ArrayList<AddedItemAdjudicationComponent>();
1852          for (AddedItemAdjudicationComponent i : adjudication)
1853            dst.adjudication.add(i.copy());
1854        };
1855        if (detail != null) {
1856          dst.detail = new ArrayList<AddedItemsDetailComponent>();
1857          for (AddedItemsDetailComponent i : detail)
1858            dst.detail.add(i.copy());
1859        };
1860        return dst;
1861      }
1862
1863      @Override
1864      public boolean equalsDeep(Base other) {
1865        if (!super.equalsDeep(other))
1866          return false;
1867        if (!(other instanceof AddedItemComponent))
1868          return false;
1869        AddedItemComponent o = (AddedItemComponent) other;
1870        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(service, o.service, true)
1871           && compareDeep(fee, o.fee, true) && compareDeep(noteNumberLinkId, o.noteNumberLinkId, true) && compareDeep(adjudication, o.adjudication, true)
1872           && compareDeep(detail, o.detail, true);
1873      }
1874
1875      @Override
1876      public boolean equalsShallow(Base other) {
1877        if (!super.equalsShallow(other))
1878          return false;
1879        if (!(other instanceof AddedItemComponent))
1880          return false;
1881        AddedItemComponent o = (AddedItemComponent) other;
1882        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(noteNumberLinkId, o.noteNumberLinkId, true)
1883          ;
1884      }
1885
1886      public boolean isEmpty() {
1887        return super.isEmpty() && (sequenceLinkId == null || sequenceLinkId.isEmpty()) && (service == null || service.isEmpty())
1888           && (fee == null || fee.isEmpty()) && (noteNumberLinkId == null || noteNumberLinkId.isEmpty())
1889           && (adjudication == null || adjudication.isEmpty()) && (detail == null || detail.isEmpty())
1890          ;
1891      }
1892
1893  public String fhirType() {
1894    return "ClaimResponse.addItem";
1895
1896  }
1897
1898  }
1899
1900    @Block()
1901    public static class AddedItemAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
1902        /**
1903         * Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.
1904         */
1905        @Child(name = "code", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
1906        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc." )
1907        protected Coding code;
1908
1909        /**
1910         * Monetary amount associated with the code.
1911         */
1912        @Child(name = "amount", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
1913        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the code." )
1914        protected Money amount;
1915
1916        /**
1917         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
1918         */
1919        @Child(name = "value", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
1920        @Description(shortDefinition="Non-monetary value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
1921        protected DecimalType value;
1922
1923        private static final long serialVersionUID = -949880587L;
1924
1925    /*
1926     * Constructor
1927     */
1928      public AddedItemAdjudicationComponent() {
1929        super();
1930      }
1931
1932    /*
1933     * Constructor
1934     */
1935      public AddedItemAdjudicationComponent(Coding code) {
1936        super();
1937        this.code = code;
1938      }
1939
1940        /**
1941         * @return {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
1942         */
1943        public Coding getCode() { 
1944          if (this.code == null)
1945            if (Configuration.errorOnAutoCreate())
1946              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.code");
1947            else if (Configuration.doAutoCreate())
1948              this.code = new Coding(); // cc
1949          return this.code;
1950        }
1951
1952        public boolean hasCode() { 
1953          return this.code != null && !this.code.isEmpty();
1954        }
1955
1956        /**
1957         * @param value {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
1958         */
1959        public AddedItemAdjudicationComponent setCode(Coding value) { 
1960          this.code = value;
1961          return this;
1962        }
1963
1964        /**
1965         * @return {@link #amount} (Monetary amount associated with the code.)
1966         */
1967        public Money getAmount() { 
1968          if (this.amount == null)
1969            if (Configuration.errorOnAutoCreate())
1970              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.amount");
1971            else if (Configuration.doAutoCreate())
1972              this.amount = new Money(); // cc
1973          return this.amount;
1974        }
1975
1976        public boolean hasAmount() { 
1977          return this.amount != null && !this.amount.isEmpty();
1978        }
1979
1980        /**
1981         * @param value {@link #amount} (Monetary amount associated with the code.)
1982         */
1983        public AddedItemAdjudicationComponent setAmount(Money value) { 
1984          this.amount = value;
1985          return this;
1986        }
1987
1988        /**
1989         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
1990         */
1991        public DecimalType getValueElement() { 
1992          if (this.value == null)
1993            if (Configuration.errorOnAutoCreate())
1994              throw new Error("Attempt to auto-create AddedItemAdjudicationComponent.value");
1995            else if (Configuration.doAutoCreate())
1996              this.value = new DecimalType(); // bb
1997          return this.value;
1998        }
1999
2000        public boolean hasValueElement() { 
2001          return this.value != null && !this.value.isEmpty();
2002        }
2003
2004        public boolean hasValue() { 
2005          return this.value != null && !this.value.isEmpty();
2006        }
2007
2008        /**
2009         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
2010         */
2011        public AddedItemAdjudicationComponent setValueElement(DecimalType value) { 
2012          this.value = value;
2013          return this;
2014        }
2015
2016        /**
2017         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
2018         */
2019        public BigDecimal getValue() { 
2020          return this.value == null ? null : this.value.getValue();
2021        }
2022
2023        /**
2024         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
2025         */
2026        public AddedItemAdjudicationComponent setValue(BigDecimal value) { 
2027          if (value == null)
2028            this.value = null;
2029          else {
2030            if (this.value == null)
2031              this.value = new DecimalType();
2032            this.value.setValue(value);
2033          }
2034          return this;
2035        }
2036
2037        protected void listChildren(List<Property> childrenList) {
2038          super.listChildren(childrenList);
2039          childrenList.add(new Property("code", "Coding", "Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, code));
2040          childrenList.add(new Property("amount", "Money", "Monetary amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
2041          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
2042        }
2043
2044      @Override
2045      public void setProperty(String name, Base value) throws FHIRException {
2046        if (name.equals("code"))
2047          this.code = castToCoding(value); // Coding
2048        else if (name.equals("amount"))
2049          this.amount = castToMoney(value); // Money
2050        else if (name.equals("value"))
2051          this.value = castToDecimal(value); // DecimalType
2052        else
2053          super.setProperty(name, value);
2054      }
2055
2056      @Override
2057      public Base addChild(String name) throws FHIRException {
2058        if (name.equals("code")) {
2059          this.code = new Coding();
2060          return this.code;
2061        }
2062        else if (name.equals("amount")) {
2063          this.amount = new Money();
2064          return this.amount;
2065        }
2066        else if (name.equals("value")) {
2067          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.value");
2068        }
2069        else
2070          return super.addChild(name);
2071      }
2072
2073      public AddedItemAdjudicationComponent copy() {
2074        AddedItemAdjudicationComponent dst = new AddedItemAdjudicationComponent();
2075        copyValues(dst);
2076        dst.code = code == null ? null : code.copy();
2077        dst.amount = amount == null ? null : amount.copy();
2078        dst.value = value == null ? null : value.copy();
2079        return dst;
2080      }
2081
2082      @Override
2083      public boolean equalsDeep(Base other) {
2084        if (!super.equalsDeep(other))
2085          return false;
2086        if (!(other instanceof AddedItemAdjudicationComponent))
2087          return false;
2088        AddedItemAdjudicationComponent o = (AddedItemAdjudicationComponent) other;
2089        return compareDeep(code, o.code, true) && compareDeep(amount, o.amount, true) && compareDeep(value, o.value, true)
2090          ;
2091      }
2092
2093      @Override
2094      public boolean equalsShallow(Base other) {
2095        if (!super.equalsShallow(other))
2096          return false;
2097        if (!(other instanceof AddedItemAdjudicationComponent))
2098          return false;
2099        AddedItemAdjudicationComponent o = (AddedItemAdjudicationComponent) other;
2100        return compareValues(value, o.value, true);
2101      }
2102
2103      public boolean isEmpty() {
2104        return super.isEmpty() && (code == null || code.isEmpty()) && (amount == null || amount.isEmpty())
2105           && (value == null || value.isEmpty());
2106      }
2107
2108  public String fhirType() {
2109    return "ClaimResponse.addItem.adjudication";
2110
2111  }
2112
2113  }
2114
2115    @Block()
2116    public static class AddedItemsDetailComponent extends BackboneElement implements IBaseBackboneElement {
2117        /**
2118         * A code to indicate the Professional Service or Product supplied.
2119         */
2120        @Child(name = "service", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
2121        @Description(shortDefinition="Service or Product", formalDefinition="A code to indicate the Professional Service or Product supplied." )
2122        protected Coding service;
2123
2124        /**
2125         * The fee charged for the professional service or product..
2126         */
2127        @Child(name = "fee", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
2128        @Description(shortDefinition="Professional fee or Product charge", formalDefinition="The fee charged for the professional service or product.." )
2129        protected Money fee;
2130
2131        /**
2132         * The adjudications results.
2133         */
2134        @Child(name = "adjudication", type = {}, order=3, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
2135        @Description(shortDefinition="Added items detail adjudication", formalDefinition="The adjudications results." )
2136        protected List<AddedItemDetailAdjudicationComponent> adjudication;
2137
2138        private static final long serialVersionUID = -2104242020L;
2139
2140    /*
2141     * Constructor
2142     */
2143      public AddedItemsDetailComponent() {
2144        super();
2145      }
2146
2147    /*
2148     * Constructor
2149     */
2150      public AddedItemsDetailComponent(Coding service) {
2151        super();
2152        this.service = service;
2153      }
2154
2155        /**
2156         * @return {@link #service} (A code to indicate the Professional Service or Product supplied.)
2157         */
2158        public Coding getService() { 
2159          if (this.service == null)
2160            if (Configuration.errorOnAutoCreate())
2161              throw new Error("Attempt to auto-create AddedItemsDetailComponent.service");
2162            else if (Configuration.doAutoCreate())
2163              this.service = new Coding(); // cc
2164          return this.service;
2165        }
2166
2167        public boolean hasService() { 
2168          return this.service != null && !this.service.isEmpty();
2169        }
2170
2171        /**
2172         * @param value {@link #service} (A code to indicate the Professional Service or Product supplied.)
2173         */
2174        public AddedItemsDetailComponent setService(Coding value) { 
2175          this.service = value;
2176          return this;
2177        }
2178
2179        /**
2180         * @return {@link #fee} (The fee charged for the professional service or product..)
2181         */
2182        public Money getFee() { 
2183          if (this.fee == null)
2184            if (Configuration.errorOnAutoCreate())
2185              throw new Error("Attempt to auto-create AddedItemsDetailComponent.fee");
2186            else if (Configuration.doAutoCreate())
2187              this.fee = new Money(); // cc
2188          return this.fee;
2189        }
2190
2191        public boolean hasFee() { 
2192          return this.fee != null && !this.fee.isEmpty();
2193        }
2194
2195        /**
2196         * @param value {@link #fee} (The fee charged for the professional service or product..)
2197         */
2198        public AddedItemsDetailComponent setFee(Money value) { 
2199          this.fee = value;
2200          return this;
2201        }
2202
2203        /**
2204         * @return {@link #adjudication} (The adjudications results.)
2205         */
2206        public List<AddedItemDetailAdjudicationComponent> getAdjudication() { 
2207          if (this.adjudication == null)
2208            this.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
2209          return this.adjudication;
2210        }
2211
2212        public boolean hasAdjudication() { 
2213          if (this.adjudication == null)
2214            return false;
2215          for (AddedItemDetailAdjudicationComponent item : this.adjudication)
2216            if (!item.isEmpty())
2217              return true;
2218          return false;
2219        }
2220
2221        /**
2222         * @return {@link #adjudication} (The adjudications results.)
2223         */
2224    // syntactic sugar
2225        public AddedItemDetailAdjudicationComponent addAdjudication() { //3
2226          AddedItemDetailAdjudicationComponent t = new AddedItemDetailAdjudicationComponent();
2227          if (this.adjudication == null)
2228            this.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
2229          this.adjudication.add(t);
2230          return t;
2231        }
2232
2233    // syntactic sugar
2234        public AddedItemsDetailComponent addAdjudication(AddedItemDetailAdjudicationComponent t) { //3
2235          if (t == null)
2236            return this;
2237          if (this.adjudication == null)
2238            this.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
2239          this.adjudication.add(t);
2240          return this;
2241        }
2242
2243        protected void listChildren(List<Property> childrenList) {
2244          super.listChildren(childrenList);
2245          childrenList.add(new Property("service", "Coding", "A code to indicate the Professional Service or Product supplied.", 0, java.lang.Integer.MAX_VALUE, service));
2246          childrenList.add(new Property("fee", "Money", "The fee charged for the professional service or product..", 0, java.lang.Integer.MAX_VALUE, fee));
2247          childrenList.add(new Property("adjudication", "", "The adjudications results.", 0, java.lang.Integer.MAX_VALUE, adjudication));
2248        }
2249
2250      @Override
2251      public void setProperty(String name, Base value) throws FHIRException {
2252        if (name.equals("service"))
2253          this.service = castToCoding(value); // Coding
2254        else if (name.equals("fee"))
2255          this.fee = castToMoney(value); // Money
2256        else if (name.equals("adjudication"))
2257          this.getAdjudication().add((AddedItemDetailAdjudicationComponent) value);
2258        else
2259          super.setProperty(name, value);
2260      }
2261
2262      @Override
2263      public Base addChild(String name) throws FHIRException {
2264        if (name.equals("service")) {
2265          this.service = new Coding();
2266          return this.service;
2267        }
2268        else if (name.equals("fee")) {
2269          this.fee = new Money();
2270          return this.fee;
2271        }
2272        else if (name.equals("adjudication")) {
2273          return addAdjudication();
2274        }
2275        else
2276          return super.addChild(name);
2277      }
2278
2279      public AddedItemsDetailComponent copy() {
2280        AddedItemsDetailComponent dst = new AddedItemsDetailComponent();
2281        copyValues(dst);
2282        dst.service = service == null ? null : service.copy();
2283        dst.fee = fee == null ? null : fee.copy();
2284        if (adjudication != null) {
2285          dst.adjudication = new ArrayList<AddedItemDetailAdjudicationComponent>();
2286          for (AddedItemDetailAdjudicationComponent i : adjudication)
2287            dst.adjudication.add(i.copy());
2288        };
2289        return dst;
2290      }
2291
2292      @Override
2293      public boolean equalsDeep(Base other) {
2294        if (!super.equalsDeep(other))
2295          return false;
2296        if (!(other instanceof AddedItemsDetailComponent))
2297          return false;
2298        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
2299        return compareDeep(service, o.service, true) && compareDeep(fee, o.fee, true) && compareDeep(adjudication, o.adjudication, true)
2300          ;
2301      }
2302
2303      @Override
2304      public boolean equalsShallow(Base other) {
2305        if (!super.equalsShallow(other))
2306          return false;
2307        if (!(other instanceof AddedItemsDetailComponent))
2308          return false;
2309        AddedItemsDetailComponent o = (AddedItemsDetailComponent) other;
2310        return true;
2311      }
2312
2313      public boolean isEmpty() {
2314        return super.isEmpty() && (service == null || service.isEmpty()) && (fee == null || fee.isEmpty())
2315           && (adjudication == null || adjudication.isEmpty());
2316      }
2317
2318  public String fhirType() {
2319    return "ClaimResponse.addItem.detail";
2320
2321  }
2322
2323  }
2324
2325    @Block()
2326    public static class AddedItemDetailAdjudicationComponent extends BackboneElement implements IBaseBackboneElement {
2327        /**
2328         * Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.
2329         */
2330        @Child(name = "code", type = {Coding.class}, order=1, min=1, max=1, modifier=false, summary=true)
2331        @Description(shortDefinition="Adjudication category such as co-pay, eligible, benefit, etc.", formalDefinition="Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc." )
2332        protected Coding code;
2333
2334        /**
2335         * Monetary amount associated with the code.
2336         */
2337        @Child(name = "amount", type = {Money.class}, order=2, min=0, max=1, modifier=false, summary=true)
2338        @Description(shortDefinition="Monetary amount", formalDefinition="Monetary amount associated with the code." )
2339        protected Money amount;
2340
2341        /**
2342         * A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
2343         */
2344        @Child(name = "value", type = {DecimalType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2345        @Description(shortDefinition="Non-monetary value", formalDefinition="A non-monetary value for example a percentage. Mutually exclusive to the amount element above." )
2346        protected DecimalType value;
2347
2348        private static final long serialVersionUID = -949880587L;
2349
2350    /*
2351     * Constructor
2352     */
2353      public AddedItemDetailAdjudicationComponent() {
2354        super();
2355      }
2356
2357    /*
2358     * Constructor
2359     */
2360      public AddedItemDetailAdjudicationComponent(Coding code) {
2361        super();
2362        this.code = code;
2363      }
2364
2365        /**
2366         * @return {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
2367         */
2368        public Coding getCode() { 
2369          if (this.code == null)
2370            if (Configuration.errorOnAutoCreate())
2371              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.code");
2372            else if (Configuration.doAutoCreate())
2373              this.code = new Coding(); // cc
2374          return this.code;
2375        }
2376
2377        public boolean hasCode() { 
2378          return this.code != null && !this.code.isEmpty();
2379        }
2380
2381        /**
2382         * @param value {@link #code} (Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.)
2383         */
2384        public AddedItemDetailAdjudicationComponent setCode(Coding value) { 
2385          this.code = value;
2386          return this;
2387        }
2388
2389        /**
2390         * @return {@link #amount} (Monetary amount associated with the code.)
2391         */
2392        public Money getAmount() { 
2393          if (this.amount == null)
2394            if (Configuration.errorOnAutoCreate())
2395              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.amount");
2396            else if (Configuration.doAutoCreate())
2397              this.amount = new Money(); // cc
2398          return this.amount;
2399        }
2400
2401        public boolean hasAmount() { 
2402          return this.amount != null && !this.amount.isEmpty();
2403        }
2404
2405        /**
2406         * @param value {@link #amount} (Monetary amount associated with the code.)
2407         */
2408        public AddedItemDetailAdjudicationComponent setAmount(Money value) { 
2409          this.amount = value;
2410          return this;
2411        }
2412
2413        /**
2414         * @return {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
2415         */
2416        public DecimalType getValueElement() { 
2417          if (this.value == null)
2418            if (Configuration.errorOnAutoCreate())
2419              throw new Error("Attempt to auto-create AddedItemDetailAdjudicationComponent.value");
2420            else if (Configuration.doAutoCreate())
2421              this.value = new DecimalType(); // bb
2422          return this.value;
2423        }
2424
2425        public boolean hasValueElement() { 
2426          return this.value != null && !this.value.isEmpty();
2427        }
2428
2429        public boolean hasValue() { 
2430          return this.value != null && !this.value.isEmpty();
2431        }
2432
2433        /**
2434         * @param value {@link #value} (A non-monetary value for example a percentage. Mutually exclusive to the amount element above.). This is the underlying object with id, value and extensions. The accessor "getValue" gives direct access to the value
2435         */
2436        public AddedItemDetailAdjudicationComponent setValueElement(DecimalType value) { 
2437          this.value = value;
2438          return this;
2439        }
2440
2441        /**
2442         * @return A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
2443         */
2444        public BigDecimal getValue() { 
2445          return this.value == null ? null : this.value.getValue();
2446        }
2447
2448        /**
2449         * @param value A non-monetary value for example a percentage. Mutually exclusive to the amount element above.
2450         */
2451        public AddedItemDetailAdjudicationComponent setValue(BigDecimal value) { 
2452          if (value == null)
2453            this.value = null;
2454          else {
2455            if (this.value == null)
2456              this.value = new DecimalType();
2457            this.value.setValue(value);
2458          }
2459          return this;
2460        }
2461
2462        protected void listChildren(List<Property> childrenList) {
2463          super.listChildren(childrenList);
2464          childrenList.add(new Property("code", "Coding", "Code indicating: Co-Pay, deductible, eligible, benefit, tax, etc.", 0, java.lang.Integer.MAX_VALUE, code));
2465          childrenList.add(new Property("amount", "Money", "Monetary amount associated with the code.", 0, java.lang.Integer.MAX_VALUE, amount));
2466          childrenList.add(new Property("value", "decimal", "A non-monetary value for example a percentage. Mutually exclusive to the amount element above.", 0, java.lang.Integer.MAX_VALUE, value));
2467        }
2468
2469      @Override
2470      public void setProperty(String name, Base value) throws FHIRException {
2471        if (name.equals("code"))
2472          this.code = castToCoding(value); // Coding
2473        else if (name.equals("amount"))
2474          this.amount = castToMoney(value); // Money
2475        else if (name.equals("value"))
2476          this.value = castToDecimal(value); // DecimalType
2477        else
2478          super.setProperty(name, value);
2479      }
2480
2481      @Override
2482      public Base addChild(String name) throws FHIRException {
2483        if (name.equals("code")) {
2484          this.code = new Coding();
2485          return this.code;
2486        }
2487        else if (name.equals("amount")) {
2488          this.amount = new Money();
2489          return this.amount;
2490        }
2491        else if (name.equals("value")) {
2492          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.value");
2493        }
2494        else
2495          return super.addChild(name);
2496      }
2497
2498      public AddedItemDetailAdjudicationComponent copy() {
2499        AddedItemDetailAdjudicationComponent dst = new AddedItemDetailAdjudicationComponent();
2500        copyValues(dst);
2501        dst.code = code == null ? null : code.copy();
2502        dst.amount = amount == null ? null : amount.copy();
2503        dst.value = value == null ? null : value.copy();
2504        return dst;
2505      }
2506
2507      @Override
2508      public boolean equalsDeep(Base other) {
2509        if (!super.equalsDeep(other))
2510          return false;
2511        if (!(other instanceof AddedItemDetailAdjudicationComponent))
2512          return false;
2513        AddedItemDetailAdjudicationComponent o = (AddedItemDetailAdjudicationComponent) other;
2514        return compareDeep(code, o.code, true) && compareDeep(amount, o.amount, true) && compareDeep(value, o.value, true)
2515          ;
2516      }
2517
2518      @Override
2519      public boolean equalsShallow(Base other) {
2520        if (!super.equalsShallow(other))
2521          return false;
2522        if (!(other instanceof AddedItemDetailAdjudicationComponent))
2523          return false;
2524        AddedItemDetailAdjudicationComponent o = (AddedItemDetailAdjudicationComponent) other;
2525        return compareValues(value, o.value, true);
2526      }
2527
2528      public boolean isEmpty() {
2529        return super.isEmpty() && (code == null || code.isEmpty()) && (amount == null || amount.isEmpty())
2530           && (value == null || value.isEmpty());
2531      }
2532
2533  public String fhirType() {
2534    return "ClaimResponse.addItem.detail.adjudication";
2535
2536  }
2537
2538  }
2539
2540    @Block()
2541    public static class ErrorsComponent extends BackboneElement implements IBaseBackboneElement {
2542        /**
2543         * The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.
2544         */
2545        @Child(name = "sequenceLinkId", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=true)
2546        @Description(shortDefinition="Item sequence number", formalDefinition="The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere." )
2547        protected PositiveIntType sequenceLinkId;
2548
2549        /**
2550         * The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
2551         */
2552        @Child(name = "detailSequenceLinkId", type = {PositiveIntType.class}, order=2, min=0, max=1, modifier=false, summary=true)
2553        @Description(shortDefinition="Detail sequence number", formalDefinition="The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition." )
2554        protected PositiveIntType detailSequenceLinkId;
2555
2556        /**
2557         * The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
2558         */
2559        @Child(name = "subdetailSequenceLinkId", type = {PositiveIntType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2560        @Description(shortDefinition="Subdetail sequence number", formalDefinition="The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition." )
2561        protected PositiveIntType subdetailSequenceLinkId;
2562
2563        /**
2564         * An error code,froma specified code system, which details why the claim could not be adjudicated.
2565         */
2566        @Child(name = "code", type = {Coding.class}, order=4, min=1, max=1, modifier=false, summary=true)
2567        @Description(shortDefinition="Error code detailing processing issues", formalDefinition="An error code,froma specified code system, which details why the claim could not be adjudicated." )
2568        protected Coding code;
2569
2570        private static final long serialVersionUID = -1893641175L;
2571
2572    /*
2573     * Constructor
2574     */
2575      public ErrorsComponent() {
2576        super();
2577      }
2578
2579    /*
2580     * Constructor
2581     */
2582      public ErrorsComponent(Coding code) {
2583        super();
2584        this.code = code;
2585      }
2586
2587        /**
2588         * @return {@link #sequenceLinkId} (The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
2589         */
2590        public PositiveIntType getSequenceLinkIdElement() { 
2591          if (this.sequenceLinkId == null)
2592            if (Configuration.errorOnAutoCreate())
2593              throw new Error("Attempt to auto-create ErrorsComponent.sequenceLinkId");
2594            else if (Configuration.doAutoCreate())
2595              this.sequenceLinkId = new PositiveIntType(); // bb
2596          return this.sequenceLinkId;
2597        }
2598
2599        public boolean hasSequenceLinkIdElement() { 
2600          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
2601        }
2602
2603        public boolean hasSequenceLinkId() { 
2604          return this.sequenceLinkId != null && !this.sequenceLinkId.isEmpty();
2605        }
2606
2607        /**
2608         * @param value {@link #sequenceLinkId} (The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.). This is the underlying object with id, value and extensions. The accessor "getSequenceLinkId" gives direct access to the value
2609         */
2610        public ErrorsComponent setSequenceLinkIdElement(PositiveIntType value) { 
2611          this.sequenceLinkId = value;
2612          return this;
2613        }
2614
2615        /**
2616         * @return The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.
2617         */
2618        public int getSequenceLinkId() { 
2619          return this.sequenceLinkId == null || this.sequenceLinkId.isEmpty() ? 0 : this.sequenceLinkId.getValue();
2620        }
2621
2622        /**
2623         * @param value The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.
2624         */
2625        public ErrorsComponent setSequenceLinkId(int value) { 
2626            if (this.sequenceLinkId == null)
2627              this.sequenceLinkId = new PositiveIntType();
2628            this.sequenceLinkId.setValue(value);
2629          return this;
2630        }
2631
2632        /**
2633         * @return {@link #detailSequenceLinkId} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.). This is the underlying object with id, value and extensions. The accessor "getDetailSequenceLinkId" gives direct access to the value
2634         */
2635        public PositiveIntType getDetailSequenceLinkIdElement() { 
2636          if (this.detailSequenceLinkId == null)
2637            if (Configuration.errorOnAutoCreate())
2638              throw new Error("Attempt to auto-create ErrorsComponent.detailSequenceLinkId");
2639            else if (Configuration.doAutoCreate())
2640              this.detailSequenceLinkId = new PositiveIntType(); // bb
2641          return this.detailSequenceLinkId;
2642        }
2643
2644        public boolean hasDetailSequenceLinkIdElement() { 
2645          return this.detailSequenceLinkId != null && !this.detailSequenceLinkId.isEmpty();
2646        }
2647
2648        public boolean hasDetailSequenceLinkId() { 
2649          return this.detailSequenceLinkId != null && !this.detailSequenceLinkId.isEmpty();
2650        }
2651
2652        /**
2653         * @param value {@link #detailSequenceLinkId} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.). This is the underlying object with id, value and extensions. The accessor "getDetailSequenceLinkId" gives direct access to the value
2654         */
2655        public ErrorsComponent setDetailSequenceLinkIdElement(PositiveIntType value) { 
2656          this.detailSequenceLinkId = value;
2657          return this;
2658        }
2659
2660        /**
2661         * @return The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
2662         */
2663        public int getDetailSequenceLinkId() { 
2664          return this.detailSequenceLinkId == null || this.detailSequenceLinkId.isEmpty() ? 0 : this.detailSequenceLinkId.getValue();
2665        }
2666
2667        /**
2668         * @param value The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
2669         */
2670        public ErrorsComponent setDetailSequenceLinkId(int value) { 
2671            if (this.detailSequenceLinkId == null)
2672              this.detailSequenceLinkId = new PositiveIntType();
2673            this.detailSequenceLinkId.setValue(value);
2674          return this;
2675        }
2676
2677        /**
2678         * @return {@link #subdetailSequenceLinkId} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.). This is the underlying object with id, value and extensions. The accessor "getSubdetailSequenceLinkId" gives direct access to the value
2679         */
2680        public PositiveIntType getSubdetailSequenceLinkIdElement() { 
2681          if (this.subdetailSequenceLinkId == null)
2682            if (Configuration.errorOnAutoCreate())
2683              throw new Error("Attempt to auto-create ErrorsComponent.subdetailSequenceLinkId");
2684            else if (Configuration.doAutoCreate())
2685              this.subdetailSequenceLinkId = new PositiveIntType(); // bb
2686          return this.subdetailSequenceLinkId;
2687        }
2688
2689        public boolean hasSubdetailSequenceLinkIdElement() { 
2690          return this.subdetailSequenceLinkId != null && !this.subdetailSequenceLinkId.isEmpty();
2691        }
2692
2693        public boolean hasSubdetailSequenceLinkId() { 
2694          return this.subdetailSequenceLinkId != null && !this.subdetailSequenceLinkId.isEmpty();
2695        }
2696
2697        /**
2698         * @param value {@link #subdetailSequenceLinkId} (The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.). This is the underlying object with id, value and extensions. The accessor "getSubdetailSequenceLinkId" gives direct access to the value
2699         */
2700        public ErrorsComponent setSubdetailSequenceLinkIdElement(PositiveIntType value) { 
2701          this.subdetailSequenceLinkId = value;
2702          return this;
2703        }
2704
2705        /**
2706         * @return The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
2707         */
2708        public int getSubdetailSequenceLinkId() { 
2709          return this.subdetailSequenceLinkId == null || this.subdetailSequenceLinkId.isEmpty() ? 0 : this.subdetailSequenceLinkId.getValue();
2710        }
2711
2712        /**
2713         * @param value The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.
2714         */
2715        public ErrorsComponent setSubdetailSequenceLinkId(int value) { 
2716            if (this.subdetailSequenceLinkId == null)
2717              this.subdetailSequenceLinkId = new PositiveIntType();
2718            this.subdetailSequenceLinkId.setValue(value);
2719          return this;
2720        }
2721
2722        /**
2723         * @return {@link #code} (An error code,froma specified code system, which details why the claim could not be adjudicated.)
2724         */
2725        public Coding getCode() { 
2726          if (this.code == null)
2727            if (Configuration.errorOnAutoCreate())
2728              throw new Error("Attempt to auto-create ErrorsComponent.code");
2729            else if (Configuration.doAutoCreate())
2730              this.code = new Coding(); // cc
2731          return this.code;
2732        }
2733
2734        public boolean hasCode() { 
2735          return this.code != null && !this.code.isEmpty();
2736        }
2737
2738        /**
2739         * @param value {@link #code} (An error code,froma specified code system, which details why the claim could not be adjudicated.)
2740         */
2741        public ErrorsComponent setCode(Coding value) { 
2742          this.code = value;
2743          return this;
2744        }
2745
2746        protected void listChildren(List<Property> childrenList) {
2747          super.listChildren(childrenList);
2748          childrenList.add(new Property("sequenceLinkId", "positiveInt", "The sequence number of the line item submitted which contains the error. This value is omitted when the error is elsewhere.", 0, java.lang.Integer.MAX_VALUE, sequenceLinkId));
2749          childrenList.add(new Property("detailSequenceLinkId", "positiveInt", "The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.", 0, java.lang.Integer.MAX_VALUE, detailSequenceLinkId));
2750          childrenList.add(new Property("subdetailSequenceLinkId", "positiveInt", "The sequence number of the addition within the line item submitted which contains the error. This value is omitted when the error is not related to an Addition.", 0, java.lang.Integer.MAX_VALUE, subdetailSequenceLinkId));
2751          childrenList.add(new Property("code", "Coding", "An error code,froma specified code system, which details why the claim could not be adjudicated.", 0, java.lang.Integer.MAX_VALUE, code));
2752        }
2753
2754      @Override
2755      public void setProperty(String name, Base value) throws FHIRException {
2756        if (name.equals("sequenceLinkId"))
2757          this.sequenceLinkId = castToPositiveInt(value); // PositiveIntType
2758        else if (name.equals("detailSequenceLinkId"))
2759          this.detailSequenceLinkId = castToPositiveInt(value); // PositiveIntType
2760        else if (name.equals("subdetailSequenceLinkId"))
2761          this.subdetailSequenceLinkId = castToPositiveInt(value); // PositiveIntType
2762        else if (name.equals("code"))
2763          this.code = castToCoding(value); // Coding
2764        else
2765          super.setProperty(name, value);
2766      }
2767
2768      @Override
2769      public Base addChild(String name) throws FHIRException {
2770        if (name.equals("sequenceLinkId")) {
2771          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequenceLinkId");
2772        }
2773        else if (name.equals("detailSequenceLinkId")) {
2774          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.detailSequenceLinkId");
2775        }
2776        else if (name.equals("subdetailSequenceLinkId")) {
2777          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.subdetailSequenceLinkId");
2778        }
2779        else if (name.equals("code")) {
2780          this.code = new Coding();
2781          return this.code;
2782        }
2783        else
2784          return super.addChild(name);
2785      }
2786
2787      public ErrorsComponent copy() {
2788        ErrorsComponent dst = new ErrorsComponent();
2789        copyValues(dst);
2790        dst.sequenceLinkId = sequenceLinkId == null ? null : sequenceLinkId.copy();
2791        dst.detailSequenceLinkId = detailSequenceLinkId == null ? null : detailSequenceLinkId.copy();
2792        dst.subdetailSequenceLinkId = subdetailSequenceLinkId == null ? null : subdetailSequenceLinkId.copy();
2793        dst.code = code == null ? null : code.copy();
2794        return dst;
2795      }
2796
2797      @Override
2798      public boolean equalsDeep(Base other) {
2799        if (!super.equalsDeep(other))
2800          return false;
2801        if (!(other instanceof ErrorsComponent))
2802          return false;
2803        ErrorsComponent o = (ErrorsComponent) other;
2804        return compareDeep(sequenceLinkId, o.sequenceLinkId, true) && compareDeep(detailSequenceLinkId, o.detailSequenceLinkId, true)
2805           && compareDeep(subdetailSequenceLinkId, o.subdetailSequenceLinkId, true) && compareDeep(code, o.code, true)
2806          ;
2807      }
2808
2809      @Override
2810      public boolean equalsShallow(Base other) {
2811        if (!super.equalsShallow(other))
2812          return false;
2813        if (!(other instanceof ErrorsComponent))
2814          return false;
2815        ErrorsComponent o = (ErrorsComponent) other;
2816        return compareValues(sequenceLinkId, o.sequenceLinkId, true) && compareValues(detailSequenceLinkId, o.detailSequenceLinkId, true)
2817           && compareValues(subdetailSequenceLinkId, o.subdetailSequenceLinkId, true);
2818      }
2819
2820      public boolean isEmpty() {
2821        return super.isEmpty() && (sequenceLinkId == null || sequenceLinkId.isEmpty()) && (detailSequenceLinkId == null || detailSequenceLinkId.isEmpty())
2822           && (subdetailSequenceLinkId == null || subdetailSequenceLinkId.isEmpty()) && (code == null || code.isEmpty())
2823          ;
2824      }
2825
2826  public String fhirType() {
2827    return "ClaimResponse.error";
2828
2829  }
2830
2831  }
2832
2833    @Block()
2834    public static class NotesComponent extends BackboneElement implements IBaseBackboneElement {
2835        /**
2836         * An integer associated with each note which may be referred to from each service line item.
2837         */
2838        @Child(name = "number", type = {PositiveIntType.class}, order=1, min=0, max=1, modifier=false, summary=true)
2839        @Description(shortDefinition="Note Number for this note", formalDefinition="An integer associated with each note which may be referred to from each service line item." )
2840        protected PositiveIntType number;
2841
2842        /**
2843         * The note purpose: Print/Display.
2844         */
2845        @Child(name = "type", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
2846        @Description(shortDefinition="display | print | printoper", formalDefinition="The note purpose: Print/Display." )
2847        protected Coding type;
2848
2849        /**
2850         * The note text.
2851         */
2852        @Child(name = "text", type = {StringType.class}, order=3, min=0, max=1, modifier=false, summary=true)
2853        @Description(shortDefinition="Note explanatory text", formalDefinition="The note text." )
2854        protected StringType text;
2855
2856        private static final long serialVersionUID = 1768923951L;
2857
2858    /*
2859     * Constructor
2860     */
2861      public NotesComponent() {
2862        super();
2863      }
2864
2865        /**
2866         * @return {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
2867         */
2868        public PositiveIntType getNumberElement() { 
2869          if (this.number == null)
2870            if (Configuration.errorOnAutoCreate())
2871              throw new Error("Attempt to auto-create NotesComponent.number");
2872            else if (Configuration.doAutoCreate())
2873              this.number = new PositiveIntType(); // bb
2874          return this.number;
2875        }
2876
2877        public boolean hasNumberElement() { 
2878          return this.number != null && !this.number.isEmpty();
2879        }
2880
2881        public boolean hasNumber() { 
2882          return this.number != null && !this.number.isEmpty();
2883        }
2884
2885        /**
2886         * @param value {@link #number} (An integer associated with each note which may be referred to from each service line item.). This is the underlying object with id, value and extensions. The accessor "getNumber" gives direct access to the value
2887         */
2888        public NotesComponent setNumberElement(PositiveIntType value) { 
2889          this.number = value;
2890          return this;
2891        }
2892
2893        /**
2894         * @return An integer associated with each note which may be referred to from each service line item.
2895         */
2896        public int getNumber() { 
2897          return this.number == null || this.number.isEmpty() ? 0 : this.number.getValue();
2898        }
2899
2900        /**
2901         * @param value An integer associated with each note which may be referred to from each service line item.
2902         */
2903        public NotesComponent setNumber(int value) { 
2904            if (this.number == null)
2905              this.number = new PositiveIntType();
2906            this.number.setValue(value);
2907          return this;
2908        }
2909
2910        /**
2911         * @return {@link #type} (The note purpose: Print/Display.)
2912         */
2913        public Coding getType() { 
2914          if (this.type == null)
2915            if (Configuration.errorOnAutoCreate())
2916              throw new Error("Attempt to auto-create NotesComponent.type");
2917            else if (Configuration.doAutoCreate())
2918              this.type = new Coding(); // cc
2919          return this.type;
2920        }
2921
2922        public boolean hasType() { 
2923          return this.type != null && !this.type.isEmpty();
2924        }
2925
2926        /**
2927         * @param value {@link #type} (The note purpose: Print/Display.)
2928         */
2929        public NotesComponent setType(Coding value) { 
2930          this.type = value;
2931          return this;
2932        }
2933
2934        /**
2935         * @return {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
2936         */
2937        public StringType getTextElement() { 
2938          if (this.text == null)
2939            if (Configuration.errorOnAutoCreate())
2940              throw new Error("Attempt to auto-create NotesComponent.text");
2941            else if (Configuration.doAutoCreate())
2942              this.text = new StringType(); // bb
2943          return this.text;
2944        }
2945
2946        public boolean hasTextElement() { 
2947          return this.text != null && !this.text.isEmpty();
2948        }
2949
2950        public boolean hasText() { 
2951          return this.text != null && !this.text.isEmpty();
2952        }
2953
2954        /**
2955         * @param value {@link #text} (The note text.). This is the underlying object with id, value and extensions. The accessor "getText" gives direct access to the value
2956         */
2957        public NotesComponent setTextElement(StringType value) { 
2958          this.text = value;
2959          return this;
2960        }
2961
2962        /**
2963         * @return The note text.
2964         */
2965        public String getText() { 
2966          return this.text == null ? null : this.text.getValue();
2967        }
2968
2969        /**
2970         * @param value The note text.
2971         */
2972        public NotesComponent setText(String value) { 
2973          if (Utilities.noString(value))
2974            this.text = null;
2975          else {
2976            if (this.text == null)
2977              this.text = new StringType();
2978            this.text.setValue(value);
2979          }
2980          return this;
2981        }
2982
2983        protected void listChildren(List<Property> childrenList) {
2984          super.listChildren(childrenList);
2985          childrenList.add(new Property("number", "positiveInt", "An integer associated with each note which may be referred to from each service line item.", 0, java.lang.Integer.MAX_VALUE, number));
2986          childrenList.add(new Property("type", "Coding", "The note purpose: Print/Display.", 0, java.lang.Integer.MAX_VALUE, type));
2987          childrenList.add(new Property("text", "string", "The note text.", 0, java.lang.Integer.MAX_VALUE, text));
2988        }
2989
2990      @Override
2991      public void setProperty(String name, Base value) throws FHIRException {
2992        if (name.equals("number"))
2993          this.number = castToPositiveInt(value); // PositiveIntType
2994        else if (name.equals("type"))
2995          this.type = castToCoding(value); // Coding
2996        else if (name.equals("text"))
2997          this.text = castToString(value); // StringType
2998        else
2999          super.setProperty(name, value);
3000      }
3001
3002      @Override
3003      public Base addChild(String name) throws FHIRException {
3004        if (name.equals("number")) {
3005          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.number");
3006        }
3007        else if (name.equals("type")) {
3008          this.type = new Coding();
3009          return this.type;
3010        }
3011        else if (name.equals("text")) {
3012          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.text");
3013        }
3014        else
3015          return super.addChild(name);
3016      }
3017
3018      public NotesComponent copy() {
3019        NotesComponent dst = new NotesComponent();
3020        copyValues(dst);
3021        dst.number = number == null ? null : number.copy();
3022        dst.type = type == null ? null : type.copy();
3023        dst.text = text == null ? null : text.copy();
3024        return dst;
3025      }
3026
3027      @Override
3028      public boolean equalsDeep(Base other) {
3029        if (!super.equalsDeep(other))
3030          return false;
3031        if (!(other instanceof NotesComponent))
3032          return false;
3033        NotesComponent o = (NotesComponent) other;
3034        return compareDeep(number, o.number, true) && compareDeep(type, o.type, true) && compareDeep(text, o.text, true)
3035          ;
3036      }
3037
3038      @Override
3039      public boolean equalsShallow(Base other) {
3040        if (!super.equalsShallow(other))
3041          return false;
3042        if (!(other instanceof NotesComponent))
3043          return false;
3044        NotesComponent o = (NotesComponent) other;
3045        return compareValues(number, o.number, true) && compareValues(text, o.text, true);
3046      }
3047
3048      public boolean isEmpty() {
3049        return super.isEmpty() && (number == null || number.isEmpty()) && (type == null || type.isEmpty())
3050           && (text == null || text.isEmpty());
3051      }
3052
3053  public String fhirType() {
3054    return "ClaimResponse.note";
3055
3056  }
3057
3058  }
3059
3060    @Block()
3061    public static class CoverageComponent extends BackboneElement implements IBaseBackboneElement {
3062        /**
3063         * A service line item.
3064         */
3065        @Child(name = "sequence", type = {PositiveIntType.class}, order=1, min=1, max=1, modifier=false, summary=true)
3066        @Description(shortDefinition="Service instance identifier", formalDefinition="A service line item." )
3067        protected PositiveIntType sequence;
3068
3069        /**
3070         * The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.
3071         */
3072        @Child(name = "focal", type = {BooleanType.class}, order=2, min=1, max=1, modifier=false, summary=true)
3073        @Description(shortDefinition="Is the focal Coverage", formalDefinition="The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated." )
3074        protected BooleanType focal;
3075
3076        /**
3077         * Reference to the program or plan identification, underwriter or payor.
3078         */
3079        @Child(name = "coverage", type = {Coverage.class}, order=3, min=1, max=1, modifier=false, summary=true)
3080        @Description(shortDefinition="Insurance information", formalDefinition="Reference to the program or plan identification, underwriter or payor." )
3081        protected Reference coverage;
3082
3083        /**
3084         * The actual object that is the target of the reference (Reference to the program or plan identification, underwriter or payor.)
3085         */
3086        protected Coverage coverageTarget;
3087
3088        /**
3089         * The contract number of a business agreement which describes the terms and conditions.
3090         */
3091        @Child(name = "businessArrangement", type = {StringType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3092        @Description(shortDefinition="Business agreement", formalDefinition="The contract number of a business agreement which describes the terms and conditions." )
3093        protected StringType businessArrangement;
3094
3095        /**
3096         * The relationship of the patient to the subscriber.
3097         */
3098        @Child(name = "relationship", type = {Coding.class}, order=5, min=1, max=1, modifier=false, summary=true)
3099        @Description(shortDefinition="Patient relationship to subscriber", formalDefinition="The relationship of the patient to the subscriber." )
3100        protected Coding relationship;
3101
3102        /**
3103         * A list of references from the Insurer to which these services pertain.
3104         */
3105        @Child(name = "preAuthRef", type = {StringType.class}, order=6, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3106        @Description(shortDefinition="Pre-Authorization/Determination Reference", formalDefinition="A list of references from the Insurer to which these services pertain." )
3107        protected List<StringType> preAuthRef;
3108
3109        /**
3110         * The Coverages adjudication details.
3111         */
3112        @Child(name = "claimResponse", type = {ClaimResponse.class}, order=7, min=0, max=1, modifier=false, summary=true)
3113        @Description(shortDefinition="Adjudication results", formalDefinition="The Coverages adjudication details." )
3114        protected Reference claimResponse;
3115
3116        /**
3117         * The actual object that is the target of the reference (The Coverages adjudication details.)
3118         */
3119        protected ClaimResponse claimResponseTarget;
3120
3121        /**
3122         * The style (standard) and version of the original material which was converted into this resource.
3123         */
3124        @Child(name = "originalRuleset", type = {Coding.class}, order=8, min=0, max=1, modifier=false, summary=true)
3125        @Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
3126        protected Coding originalRuleset;
3127
3128        private static final long serialVersionUID = 621250924L;
3129
3130    /*
3131     * Constructor
3132     */
3133      public CoverageComponent() {
3134        super();
3135      }
3136
3137    /*
3138     * Constructor
3139     */
3140      public CoverageComponent(PositiveIntType sequence, BooleanType focal, Reference coverage, Coding relationship) {
3141        super();
3142        this.sequence = sequence;
3143        this.focal = focal;
3144        this.coverage = coverage;
3145        this.relationship = relationship;
3146      }
3147
3148        /**
3149         * @return {@link #sequence} (A service line item.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3150         */
3151        public PositiveIntType getSequenceElement() { 
3152          if (this.sequence == null)
3153            if (Configuration.errorOnAutoCreate())
3154              throw new Error("Attempt to auto-create CoverageComponent.sequence");
3155            else if (Configuration.doAutoCreate())
3156              this.sequence = new PositiveIntType(); // bb
3157          return this.sequence;
3158        }
3159
3160        public boolean hasSequenceElement() { 
3161          return this.sequence != null && !this.sequence.isEmpty();
3162        }
3163
3164        public boolean hasSequence() { 
3165          return this.sequence != null && !this.sequence.isEmpty();
3166        }
3167
3168        /**
3169         * @param value {@link #sequence} (A service line item.). This is the underlying object with id, value and extensions. The accessor "getSequence" gives direct access to the value
3170         */
3171        public CoverageComponent setSequenceElement(PositiveIntType value) { 
3172          this.sequence = value;
3173          return this;
3174        }
3175
3176        /**
3177         * @return A service line item.
3178         */
3179        public int getSequence() { 
3180          return this.sequence == null || this.sequence.isEmpty() ? 0 : this.sequence.getValue();
3181        }
3182
3183        /**
3184         * @param value A service line item.
3185         */
3186        public CoverageComponent setSequence(int value) { 
3187            if (this.sequence == null)
3188              this.sequence = new PositiveIntType();
3189            this.sequence.setValue(value);
3190          return this;
3191        }
3192
3193        /**
3194         * @return {@link #focal} (The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
3195         */
3196        public BooleanType getFocalElement() { 
3197          if (this.focal == null)
3198            if (Configuration.errorOnAutoCreate())
3199              throw new Error("Attempt to auto-create CoverageComponent.focal");
3200            else if (Configuration.doAutoCreate())
3201              this.focal = new BooleanType(); // bb
3202          return this.focal;
3203        }
3204
3205        public boolean hasFocalElement() { 
3206          return this.focal != null && !this.focal.isEmpty();
3207        }
3208
3209        public boolean hasFocal() { 
3210          return this.focal != null && !this.focal.isEmpty();
3211        }
3212
3213        /**
3214         * @param value {@link #focal} (The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.). This is the underlying object with id, value and extensions. The accessor "getFocal" gives direct access to the value
3215         */
3216        public CoverageComponent setFocalElement(BooleanType value) { 
3217          this.focal = value;
3218          return this;
3219        }
3220
3221        /**
3222         * @return The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.
3223         */
3224        public boolean getFocal() { 
3225          return this.focal == null || this.focal.isEmpty() ? false : this.focal.getValue();
3226        }
3227
3228        /**
3229         * @param value The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.
3230         */
3231        public CoverageComponent setFocal(boolean value) { 
3232            if (this.focal == null)
3233              this.focal = new BooleanType();
3234            this.focal.setValue(value);
3235          return this;
3236        }
3237
3238        /**
3239         * @return {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
3240         */
3241        public Reference getCoverage() { 
3242          if (this.coverage == null)
3243            if (Configuration.errorOnAutoCreate())
3244              throw new Error("Attempt to auto-create CoverageComponent.coverage");
3245            else if (Configuration.doAutoCreate())
3246              this.coverage = new Reference(); // cc
3247          return this.coverage;
3248        }
3249
3250        public boolean hasCoverage() { 
3251          return this.coverage != null && !this.coverage.isEmpty();
3252        }
3253
3254        /**
3255         * @param value {@link #coverage} (Reference to the program or plan identification, underwriter or payor.)
3256         */
3257        public CoverageComponent setCoverage(Reference value) { 
3258          this.coverage = value;
3259          return this;
3260        }
3261
3262        /**
3263         * @return {@link #coverage} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
3264         */
3265        public Coverage getCoverageTarget() { 
3266          if (this.coverageTarget == null)
3267            if (Configuration.errorOnAutoCreate())
3268              throw new Error("Attempt to auto-create CoverageComponent.coverage");
3269            else if (Configuration.doAutoCreate())
3270              this.coverageTarget = new Coverage(); // aa
3271          return this.coverageTarget;
3272        }
3273
3274        /**
3275         * @param value {@link #coverage} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Reference to the program or plan identification, underwriter or payor.)
3276         */
3277        public CoverageComponent setCoverageTarget(Coverage value) { 
3278          this.coverageTarget = value;
3279          return this;
3280        }
3281
3282        /**
3283         * @return {@link #businessArrangement} (The contract number of a business agreement which describes the terms and conditions.). This is the underlying object with id, value and extensions. The accessor "getBusinessArrangement" gives direct access to the value
3284         */
3285        public StringType getBusinessArrangementElement() { 
3286          if (this.businessArrangement == null)
3287            if (Configuration.errorOnAutoCreate())
3288              throw new Error("Attempt to auto-create CoverageComponent.businessArrangement");
3289            else if (Configuration.doAutoCreate())
3290              this.businessArrangement = new StringType(); // bb
3291          return this.businessArrangement;
3292        }
3293
3294        public boolean hasBusinessArrangementElement() { 
3295          return this.businessArrangement != null && !this.businessArrangement.isEmpty();
3296        }
3297
3298        public boolean hasBusinessArrangement() { 
3299          return this.businessArrangement != null && !this.businessArrangement.isEmpty();
3300        }
3301
3302        /**
3303         * @param value {@link #businessArrangement} (The contract number of a business agreement which describes the terms and conditions.). This is the underlying object with id, value and extensions. The accessor "getBusinessArrangement" gives direct access to the value
3304         */
3305        public CoverageComponent setBusinessArrangementElement(StringType value) { 
3306          this.businessArrangement = value;
3307          return this;
3308        }
3309
3310        /**
3311         * @return The contract number of a business agreement which describes the terms and conditions.
3312         */
3313        public String getBusinessArrangement() { 
3314          return this.businessArrangement == null ? null : this.businessArrangement.getValue();
3315        }
3316
3317        /**
3318         * @param value The contract number of a business agreement which describes the terms and conditions.
3319         */
3320        public CoverageComponent setBusinessArrangement(String value) { 
3321          if (Utilities.noString(value))
3322            this.businessArrangement = null;
3323          else {
3324            if (this.businessArrangement == null)
3325              this.businessArrangement = new StringType();
3326            this.businessArrangement.setValue(value);
3327          }
3328          return this;
3329        }
3330
3331        /**
3332         * @return {@link #relationship} (The relationship of the patient to the subscriber.)
3333         */
3334        public Coding getRelationship() { 
3335          if (this.relationship == null)
3336            if (Configuration.errorOnAutoCreate())
3337              throw new Error("Attempt to auto-create CoverageComponent.relationship");
3338            else if (Configuration.doAutoCreate())
3339              this.relationship = new Coding(); // cc
3340          return this.relationship;
3341        }
3342
3343        public boolean hasRelationship() { 
3344          return this.relationship != null && !this.relationship.isEmpty();
3345        }
3346
3347        /**
3348         * @param value {@link #relationship} (The relationship of the patient to the subscriber.)
3349         */
3350        public CoverageComponent setRelationship(Coding value) { 
3351          this.relationship = value;
3352          return this;
3353        }
3354
3355        /**
3356         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
3357         */
3358        public List<StringType> getPreAuthRef() { 
3359          if (this.preAuthRef == null)
3360            this.preAuthRef = new ArrayList<StringType>();
3361          return this.preAuthRef;
3362        }
3363
3364        public boolean hasPreAuthRef() { 
3365          if (this.preAuthRef == null)
3366            return false;
3367          for (StringType item : this.preAuthRef)
3368            if (!item.isEmpty())
3369              return true;
3370          return false;
3371        }
3372
3373        /**
3374         * @return {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
3375         */
3376    // syntactic sugar
3377        public StringType addPreAuthRefElement() {//2 
3378          StringType t = new StringType();
3379          if (this.preAuthRef == null)
3380            this.preAuthRef = new ArrayList<StringType>();
3381          this.preAuthRef.add(t);
3382          return t;
3383        }
3384
3385        /**
3386         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
3387         */
3388        public CoverageComponent addPreAuthRef(String value) { //1
3389          StringType t = new StringType();
3390          t.setValue(value);
3391          if (this.preAuthRef == null)
3392            this.preAuthRef = new ArrayList<StringType>();
3393          this.preAuthRef.add(t);
3394          return this;
3395        }
3396
3397        /**
3398         * @param value {@link #preAuthRef} (A list of references from the Insurer to which these services pertain.)
3399         */
3400        public boolean hasPreAuthRef(String value) { 
3401          if (this.preAuthRef == null)
3402            return false;
3403          for (StringType v : this.preAuthRef)
3404            if (v.equals(value)) // string
3405              return true;
3406          return false;
3407        }
3408
3409        /**
3410         * @return {@link #claimResponse} (The Coverages adjudication details.)
3411         */
3412        public Reference getClaimResponse() { 
3413          if (this.claimResponse == null)
3414            if (Configuration.errorOnAutoCreate())
3415              throw new Error("Attempt to auto-create CoverageComponent.claimResponse");
3416            else if (Configuration.doAutoCreate())
3417              this.claimResponse = new Reference(); // cc
3418          return this.claimResponse;
3419        }
3420
3421        public boolean hasClaimResponse() { 
3422          return this.claimResponse != null && !this.claimResponse.isEmpty();
3423        }
3424
3425        /**
3426         * @param value {@link #claimResponse} (The Coverages adjudication details.)
3427         */
3428        public CoverageComponent setClaimResponse(Reference value) { 
3429          this.claimResponse = value;
3430          return this;
3431        }
3432
3433        /**
3434         * @return {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Coverages adjudication details.)
3435         */
3436        public ClaimResponse getClaimResponseTarget() { 
3437          if (this.claimResponseTarget == null)
3438            if (Configuration.errorOnAutoCreate())
3439              throw new Error("Attempt to auto-create CoverageComponent.claimResponse");
3440            else if (Configuration.doAutoCreate())
3441              this.claimResponseTarget = new ClaimResponse(); // aa
3442          return this.claimResponseTarget;
3443        }
3444
3445        /**
3446         * @param value {@link #claimResponse} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Coverages adjudication details.)
3447         */
3448        public CoverageComponent setClaimResponseTarget(ClaimResponse value) { 
3449          this.claimResponseTarget = value;
3450          return this;
3451        }
3452
3453        /**
3454         * @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
3455         */
3456        public Coding getOriginalRuleset() { 
3457          if (this.originalRuleset == null)
3458            if (Configuration.errorOnAutoCreate())
3459              throw new Error("Attempt to auto-create CoverageComponent.originalRuleset");
3460            else if (Configuration.doAutoCreate())
3461              this.originalRuleset = new Coding(); // cc
3462          return this.originalRuleset;
3463        }
3464
3465        public boolean hasOriginalRuleset() { 
3466          return this.originalRuleset != null && !this.originalRuleset.isEmpty();
3467        }
3468
3469        /**
3470         * @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
3471         */
3472        public CoverageComponent setOriginalRuleset(Coding value) { 
3473          this.originalRuleset = value;
3474          return this;
3475        }
3476
3477        protected void listChildren(List<Property> childrenList) {
3478          super.listChildren(childrenList);
3479          childrenList.add(new Property("sequence", "positiveInt", "A service line item.", 0, java.lang.Integer.MAX_VALUE, sequence));
3480          childrenList.add(new Property("focal", "boolean", "The instance number of the Coverage which is the focus for adjudication. The Coverage against which the claim is to be adjudicated.", 0, java.lang.Integer.MAX_VALUE, focal));
3481          childrenList.add(new Property("coverage", "Reference(Coverage)", "Reference to the program or plan identification, underwriter or payor.", 0, java.lang.Integer.MAX_VALUE, coverage));
3482          childrenList.add(new Property("businessArrangement", "string", "The contract number of a business agreement which describes the terms and conditions.", 0, java.lang.Integer.MAX_VALUE, businessArrangement));
3483          childrenList.add(new Property("relationship", "Coding", "The relationship of the patient to the subscriber.", 0, java.lang.Integer.MAX_VALUE, relationship));
3484          childrenList.add(new Property("preAuthRef", "string", "A list of references from the Insurer to which these services pertain.", 0, java.lang.Integer.MAX_VALUE, preAuthRef));
3485          childrenList.add(new Property("claimResponse", "Reference(ClaimResponse)", "The Coverages adjudication details.", 0, java.lang.Integer.MAX_VALUE, claimResponse));
3486          childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
3487        }
3488
3489      @Override
3490      public void setProperty(String name, Base value) throws FHIRException {
3491        if (name.equals("sequence"))
3492          this.sequence = castToPositiveInt(value); // PositiveIntType
3493        else if (name.equals("focal"))
3494          this.focal = castToBoolean(value); // BooleanType
3495        else if (name.equals("coverage"))
3496          this.coverage = castToReference(value); // Reference
3497        else if (name.equals("businessArrangement"))
3498          this.businessArrangement = castToString(value); // StringType
3499        else if (name.equals("relationship"))
3500          this.relationship = castToCoding(value); // Coding
3501        else if (name.equals("preAuthRef"))
3502          this.getPreAuthRef().add(castToString(value));
3503        else if (name.equals("claimResponse"))
3504          this.claimResponse = castToReference(value); // Reference
3505        else if (name.equals("originalRuleset"))
3506          this.originalRuleset = castToCoding(value); // Coding
3507        else
3508          super.setProperty(name, value);
3509      }
3510
3511      @Override
3512      public Base addChild(String name) throws FHIRException {
3513        if (name.equals("sequence")) {
3514          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.sequence");
3515        }
3516        else if (name.equals("focal")) {
3517          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.focal");
3518        }
3519        else if (name.equals("coverage")) {
3520          this.coverage = new Reference();
3521          return this.coverage;
3522        }
3523        else if (name.equals("businessArrangement")) {
3524          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.businessArrangement");
3525        }
3526        else if (name.equals("relationship")) {
3527          this.relationship = new Coding();
3528          return this.relationship;
3529        }
3530        else if (name.equals("preAuthRef")) {
3531          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.preAuthRef");
3532        }
3533        else if (name.equals("claimResponse")) {
3534          this.claimResponse = new Reference();
3535          return this.claimResponse;
3536        }
3537        else if (name.equals("originalRuleset")) {
3538          this.originalRuleset = new Coding();
3539          return this.originalRuleset;
3540        }
3541        else
3542          return super.addChild(name);
3543      }
3544
3545      public CoverageComponent copy() {
3546        CoverageComponent dst = new CoverageComponent();
3547        copyValues(dst);
3548        dst.sequence = sequence == null ? null : sequence.copy();
3549        dst.focal = focal == null ? null : focal.copy();
3550        dst.coverage = coverage == null ? null : coverage.copy();
3551        dst.businessArrangement = businessArrangement == null ? null : businessArrangement.copy();
3552        dst.relationship = relationship == null ? null : relationship.copy();
3553        if (preAuthRef != null) {
3554          dst.preAuthRef = new ArrayList<StringType>();
3555          for (StringType i : preAuthRef)
3556            dst.preAuthRef.add(i.copy());
3557        };
3558        dst.claimResponse = claimResponse == null ? null : claimResponse.copy();
3559        dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
3560        return dst;
3561      }
3562
3563      @Override
3564      public boolean equalsDeep(Base other) {
3565        if (!super.equalsDeep(other))
3566          return false;
3567        if (!(other instanceof CoverageComponent))
3568          return false;
3569        CoverageComponent o = (CoverageComponent) other;
3570        return compareDeep(sequence, o.sequence, true) && compareDeep(focal, o.focal, true) && compareDeep(coverage, o.coverage, true)
3571           && compareDeep(businessArrangement, o.businessArrangement, true) && compareDeep(relationship, o.relationship, true)
3572           && compareDeep(preAuthRef, o.preAuthRef, true) && compareDeep(claimResponse, o.claimResponse, true)
3573           && compareDeep(originalRuleset, o.originalRuleset, true);
3574      }
3575
3576      @Override
3577      public boolean equalsShallow(Base other) {
3578        if (!super.equalsShallow(other))
3579          return false;
3580        if (!(other instanceof CoverageComponent))
3581          return false;
3582        CoverageComponent o = (CoverageComponent) other;
3583        return compareValues(sequence, o.sequence, true) && compareValues(focal, o.focal, true) && compareValues(businessArrangement, o.businessArrangement, true)
3584           && compareValues(preAuthRef, o.preAuthRef, true);
3585      }
3586
3587      public boolean isEmpty() {
3588        return super.isEmpty() && (sequence == null || sequence.isEmpty()) && (focal == null || focal.isEmpty())
3589           && (coverage == null || coverage.isEmpty()) && (businessArrangement == null || businessArrangement.isEmpty())
3590           && (relationship == null || relationship.isEmpty()) && (preAuthRef == null || preAuthRef.isEmpty())
3591           && (claimResponse == null || claimResponse.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
3592          ;
3593      }
3594
3595  public String fhirType() {
3596    return "ClaimResponse.coverage";
3597
3598  }
3599
3600  }
3601
3602    /**
3603     * The Response business identifier.
3604     */
3605    @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3606    @Description(shortDefinition="Response  number", formalDefinition="The Response business identifier." )
3607    protected List<Identifier> identifier;
3608
3609    /**
3610     * Original request resource referrence.
3611     */
3612    @Child(name = "request", type = {Claim.class}, order=1, min=0, max=1, modifier=false, summary=true)
3613    @Description(shortDefinition="Id of resource triggering adjudication", formalDefinition="Original request resource referrence." )
3614    protected Reference request;
3615
3616    /**
3617     * The actual object that is the target of the reference (Original request resource referrence.)
3618     */
3619    protected Claim requestTarget;
3620
3621    /**
3622     * The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.
3623     */
3624    @Child(name = "ruleset", type = {Coding.class}, order=2, min=0, max=1, modifier=false, summary=true)
3625    @Description(shortDefinition="Resource version", formalDefinition="The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources." )
3626    protected Coding ruleset;
3627
3628    /**
3629     * The style (standard) and version of the original material which was converted into this resource.
3630     */
3631    @Child(name = "originalRuleset", type = {Coding.class}, order=3, min=0, max=1, modifier=false, summary=true)
3632    @Description(shortDefinition="Original version", formalDefinition="The style (standard) and version of the original material which was converted into this resource." )
3633    protected Coding originalRuleset;
3634
3635    /**
3636     * The date when the enclosed suite of services were performed or completed.
3637     */
3638    @Child(name = "created", type = {DateTimeType.class}, order=4, min=0, max=1, modifier=false, summary=true)
3639    @Description(shortDefinition="Creation date", formalDefinition="The date when the enclosed suite of services were performed or completed." )
3640    protected DateTimeType created;
3641
3642    /**
3643     * The Insurer who produced this adjudicated response.
3644     */
3645    @Child(name = "organization", type = {Organization.class}, order=5, min=0, max=1, modifier=false, summary=true)
3646    @Description(shortDefinition="Insurer", formalDefinition="The Insurer who produced this adjudicated response." )
3647    protected Reference organization;
3648
3649    /**
3650     * The actual object that is the target of the reference (The Insurer who produced this adjudicated response.)
3651     */
3652    protected Organization organizationTarget;
3653
3654    /**
3655     * The practitioner who is responsible for the services rendered to the patient.
3656     */
3657    @Child(name = "requestProvider", type = {Practitioner.class}, order=6, min=0, max=1, modifier=false, summary=true)
3658    @Description(shortDefinition="Responsible practitioner", formalDefinition="The practitioner who is responsible for the services rendered to the patient." )
3659    protected Reference requestProvider;
3660
3661    /**
3662     * The actual object that is the target of the reference (The practitioner who is responsible for the services rendered to the patient.)
3663     */
3664    protected Practitioner requestProviderTarget;
3665
3666    /**
3667     * The organization which is responsible for the services rendered to the patient.
3668     */
3669    @Child(name = "requestOrganization", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=true)
3670    @Description(shortDefinition="Responsible organization", formalDefinition="The organization which is responsible for the services rendered to the patient." )
3671    protected Reference requestOrganization;
3672
3673    /**
3674     * The actual object that is the target of the reference (The organization which is responsible for the services rendered to the patient.)
3675     */
3676    protected Organization requestOrganizationTarget;
3677
3678    /**
3679     * Transaction status: error, complete.
3680     */
3681    @Child(name = "outcome", type = {CodeType.class}, order=8, min=0, max=1, modifier=false, summary=true)
3682    @Description(shortDefinition="complete | error", formalDefinition="Transaction status: error, complete." )
3683    protected Enumeration<RemittanceOutcome> outcome;
3684
3685    /**
3686     * A description of the status of the adjudication.
3687     */
3688    @Child(name = "disposition", type = {StringType.class}, order=9, min=0, max=1, modifier=false, summary=true)
3689    @Description(shortDefinition="Disposition Message", formalDefinition="A description of the status of the adjudication." )
3690    protected StringType disposition;
3691
3692    /**
3693     * Party to be reimbursed: Subscriber, provider, other.
3694     */
3695    @Child(name = "payeeType", type = {Coding.class}, order=10, min=0, max=1, modifier=false, summary=true)
3696    @Description(shortDefinition="Party to be paid any benefits payable", formalDefinition="Party to be reimbursed: Subscriber, provider, other." )
3697    protected Coding payeeType;
3698
3699    /**
3700     * The first tier service adjudications for submitted services.
3701     */
3702    @Child(name = "item", type = {}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3703    @Description(shortDefinition="Line items", formalDefinition="The first tier service adjudications for submitted services." )
3704    protected List<ItemsComponent> item;
3705
3706    /**
3707     * The first tier service adjudications for payor added services.
3708     */
3709    @Child(name = "addItem", type = {}, order=12, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3710    @Description(shortDefinition="Insurer added line items", formalDefinition="The first tier service adjudications for payor added services." )
3711    protected List<AddedItemComponent> addItem;
3712
3713    /**
3714     * Mutually exclusive with Services Provided (Item).
3715     */
3716    @Child(name = "error", type = {}, order=13, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3717    @Description(shortDefinition="Processing errors", formalDefinition="Mutually exclusive with Services Provided (Item)." )
3718    protected List<ErrorsComponent> error;
3719
3720    /**
3721     * The total cost of the services reported.
3722     */
3723    @Child(name = "totalCost", type = {Money.class}, order=14, min=0, max=1, modifier=false, summary=true)
3724    @Description(shortDefinition="Total Cost of service from the Claim", formalDefinition="The total cost of the services reported." )
3725    protected Money totalCost;
3726
3727    /**
3728     * The amount of deductible applied which was not allocated to any particular service line.
3729     */
3730    @Child(name = "unallocDeductable", type = {Money.class}, order=15, min=0, max=1, modifier=false, summary=true)
3731    @Description(shortDefinition="Unallocated deductible", formalDefinition="The amount of deductible applied which was not allocated to any particular service line." )
3732    protected Money unallocDeductable;
3733
3734    /**
3735     * Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible).
3736     */
3737    @Child(name = "totalBenefit", type = {Money.class}, order=16, min=0, max=1, modifier=false, summary=true)
3738    @Description(shortDefinition="Total benefit payable for the Claim", formalDefinition="Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible)." )
3739    protected Money totalBenefit;
3740
3741    /**
3742     * Adjustment to the payment of this transaction which is not related to adjudication of this transaction.
3743     */
3744    @Child(name = "paymentAdjustment", type = {Money.class}, order=17, min=0, max=1, modifier=false, summary=true)
3745    @Description(shortDefinition="Payment adjustment for non-Claim issues", formalDefinition="Adjustment to the payment of this transaction which is not related to adjudication of this transaction." )
3746    protected Money paymentAdjustment;
3747
3748    /**
3749     * Reason for the payment adjustment.
3750     */
3751    @Child(name = "paymentAdjustmentReason", type = {Coding.class}, order=18, min=0, max=1, modifier=false, summary=true)
3752    @Description(shortDefinition="Reason for Payment adjustment", formalDefinition="Reason for the payment adjustment." )
3753    protected Coding paymentAdjustmentReason;
3754
3755    /**
3756     * Estimated payment data.
3757     */
3758    @Child(name = "paymentDate", type = {DateType.class}, order=19, min=0, max=1, modifier=false, summary=true)
3759    @Description(shortDefinition="Expected data of Payment", formalDefinition="Estimated payment data." )
3760    protected DateType paymentDate;
3761
3762    /**
3763     * Payable less any payment adjustment.
3764     */
3765    @Child(name = "paymentAmount", type = {Money.class}, order=20, min=0, max=1, modifier=false, summary=true)
3766    @Description(shortDefinition="Payment amount", formalDefinition="Payable less any payment adjustment." )
3767    protected Money paymentAmount;
3768
3769    /**
3770     * Payment identifier.
3771     */
3772    @Child(name = "paymentRef", type = {Identifier.class}, order=21, min=0, max=1, modifier=false, summary=true)
3773    @Description(shortDefinition="Payment identifier", formalDefinition="Payment identifier." )
3774    protected Identifier paymentRef;
3775
3776    /**
3777     * Status of funds reservation (For provider, for Patient, None).
3778     */
3779    @Child(name = "reserved", type = {Coding.class}, order=22, min=0, max=1, modifier=false, summary=true)
3780    @Description(shortDefinition="Funds reserved status", formalDefinition="Status of funds reservation (For provider, for Patient, None)." )
3781    protected Coding reserved;
3782
3783    /**
3784     * The form to be used for printing the content.
3785     */
3786    @Child(name = "form", type = {Coding.class}, order=23, min=0, max=1, modifier=false, summary=true)
3787    @Description(shortDefinition="Printed Form Identifier", formalDefinition="The form to be used for printing the content." )
3788    protected Coding form;
3789
3790    /**
3791     * Note text.
3792     */
3793    @Child(name = "note", type = {}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3794    @Description(shortDefinition="Processing notes", formalDefinition="Note text." )
3795    protected List<NotesComponent> note;
3796
3797    /**
3798     * Financial instrument by which payment information for health care.
3799     */
3800    @Child(name = "coverage", type = {}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true)
3801    @Description(shortDefinition="Insurance or medical plan", formalDefinition="Financial instrument by which payment information for health care." )
3802    protected List<CoverageComponent> coverage;
3803
3804    private static final long serialVersionUID = 2021598689L;
3805
3806  /*
3807   * Constructor
3808   */
3809    public ClaimResponse() {
3810      super();
3811    }
3812
3813    /**
3814     * @return {@link #identifier} (The Response business identifier.)
3815     */
3816    public List<Identifier> getIdentifier() { 
3817      if (this.identifier == null)
3818        this.identifier = new ArrayList<Identifier>();
3819      return this.identifier;
3820    }
3821
3822    public boolean hasIdentifier() { 
3823      if (this.identifier == null)
3824        return false;
3825      for (Identifier item : this.identifier)
3826        if (!item.isEmpty())
3827          return true;
3828      return false;
3829    }
3830
3831    /**
3832     * @return {@link #identifier} (The Response business identifier.)
3833     */
3834    // syntactic sugar
3835    public Identifier addIdentifier() { //3
3836      Identifier t = new Identifier();
3837      if (this.identifier == null)
3838        this.identifier = new ArrayList<Identifier>();
3839      this.identifier.add(t);
3840      return t;
3841    }
3842
3843    // syntactic sugar
3844    public ClaimResponse addIdentifier(Identifier t) { //3
3845      if (t == null)
3846        return this;
3847      if (this.identifier == null)
3848        this.identifier = new ArrayList<Identifier>();
3849      this.identifier.add(t);
3850      return this;
3851    }
3852
3853    /**
3854     * @return {@link #request} (Original request resource referrence.)
3855     */
3856    public Reference getRequest() { 
3857      if (this.request == null)
3858        if (Configuration.errorOnAutoCreate())
3859          throw new Error("Attempt to auto-create ClaimResponse.request");
3860        else if (Configuration.doAutoCreate())
3861          this.request = new Reference(); // cc
3862      return this.request;
3863    }
3864
3865    public boolean hasRequest() { 
3866      return this.request != null && !this.request.isEmpty();
3867    }
3868
3869    /**
3870     * @param value {@link #request} (Original request resource referrence.)
3871     */
3872    public ClaimResponse setRequest(Reference value) { 
3873      this.request = value;
3874      return this;
3875    }
3876
3877    /**
3878     * @return {@link #request} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Original request resource referrence.)
3879     */
3880    public Claim getRequestTarget() { 
3881      if (this.requestTarget == null)
3882        if (Configuration.errorOnAutoCreate())
3883          throw new Error("Attempt to auto-create ClaimResponse.request");
3884        else if (Configuration.doAutoCreate())
3885          this.requestTarget = new Claim(); // aa
3886      return this.requestTarget;
3887    }
3888
3889    /**
3890     * @param value {@link #request} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Original request resource referrence.)
3891     */
3892    public ClaimResponse setRequestTarget(Claim value) { 
3893      this.requestTarget = value;
3894      return this;
3895    }
3896
3897    /**
3898     * @return {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
3899     */
3900    public Coding getRuleset() { 
3901      if (this.ruleset == null)
3902        if (Configuration.errorOnAutoCreate())
3903          throw new Error("Attempt to auto-create ClaimResponse.ruleset");
3904        else if (Configuration.doAutoCreate())
3905          this.ruleset = new Coding(); // cc
3906      return this.ruleset;
3907    }
3908
3909    public boolean hasRuleset() { 
3910      return this.ruleset != null && !this.ruleset.isEmpty();
3911    }
3912
3913    /**
3914     * @param value {@link #ruleset} (The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.)
3915     */
3916    public ClaimResponse setRuleset(Coding value) { 
3917      this.ruleset = value;
3918      return this;
3919    }
3920
3921    /**
3922     * @return {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
3923     */
3924    public Coding getOriginalRuleset() { 
3925      if (this.originalRuleset == null)
3926        if (Configuration.errorOnAutoCreate())
3927          throw new Error("Attempt to auto-create ClaimResponse.originalRuleset");
3928        else if (Configuration.doAutoCreate())
3929          this.originalRuleset = new Coding(); // cc
3930      return this.originalRuleset;
3931    }
3932
3933    public boolean hasOriginalRuleset() { 
3934      return this.originalRuleset != null && !this.originalRuleset.isEmpty();
3935    }
3936
3937    /**
3938     * @param value {@link #originalRuleset} (The style (standard) and version of the original material which was converted into this resource.)
3939     */
3940    public ClaimResponse setOriginalRuleset(Coding value) { 
3941      this.originalRuleset = value;
3942      return this;
3943    }
3944
3945    /**
3946     * @return {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
3947     */
3948    public DateTimeType getCreatedElement() { 
3949      if (this.created == null)
3950        if (Configuration.errorOnAutoCreate())
3951          throw new Error("Attempt to auto-create ClaimResponse.created");
3952        else if (Configuration.doAutoCreate())
3953          this.created = new DateTimeType(); // bb
3954      return this.created;
3955    }
3956
3957    public boolean hasCreatedElement() { 
3958      return this.created != null && !this.created.isEmpty();
3959    }
3960
3961    public boolean hasCreated() { 
3962      return this.created != null && !this.created.isEmpty();
3963    }
3964
3965    /**
3966     * @param value {@link #created} (The date when the enclosed suite of services were performed or completed.). This is the underlying object with id, value and extensions. The accessor "getCreated" gives direct access to the value
3967     */
3968    public ClaimResponse setCreatedElement(DateTimeType value) { 
3969      this.created = value;
3970      return this;
3971    }
3972
3973    /**
3974     * @return The date when the enclosed suite of services were performed or completed.
3975     */
3976    public Date getCreated() { 
3977      return this.created == null ? null : this.created.getValue();
3978    }
3979
3980    /**
3981     * @param value The date when the enclosed suite of services were performed or completed.
3982     */
3983    public ClaimResponse setCreated(Date value) { 
3984      if (value == null)
3985        this.created = null;
3986      else {
3987        if (this.created == null)
3988          this.created = new DateTimeType();
3989        this.created.setValue(value);
3990      }
3991      return this;
3992    }
3993
3994    /**
3995     * @return {@link #organization} (The Insurer who produced this adjudicated response.)
3996     */
3997    public Reference getOrganization() { 
3998      if (this.organization == null)
3999        if (Configuration.errorOnAutoCreate())
4000          throw new Error("Attempt to auto-create ClaimResponse.organization");
4001        else if (Configuration.doAutoCreate())
4002          this.organization = new Reference(); // cc
4003      return this.organization;
4004    }
4005
4006    public boolean hasOrganization() { 
4007      return this.organization != null && !this.organization.isEmpty();
4008    }
4009
4010    /**
4011     * @param value {@link #organization} (The Insurer who produced this adjudicated response.)
4012     */
4013    public ClaimResponse setOrganization(Reference value) { 
4014      this.organization = value;
4015      return this;
4016    }
4017
4018    /**
4019     * @return {@link #organization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
4020     */
4021    public Organization getOrganizationTarget() { 
4022      if (this.organizationTarget == null)
4023        if (Configuration.errorOnAutoCreate())
4024          throw new Error("Attempt to auto-create ClaimResponse.organization");
4025        else if (Configuration.doAutoCreate())
4026          this.organizationTarget = new Organization(); // aa
4027      return this.organizationTarget;
4028    }
4029
4030    /**
4031     * @param value {@link #organization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Insurer who produced this adjudicated response.)
4032     */
4033    public ClaimResponse setOrganizationTarget(Organization value) { 
4034      this.organizationTarget = value;
4035      return this;
4036    }
4037
4038    /**
4039     * @return {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
4040     */
4041    public Reference getRequestProvider() { 
4042      if (this.requestProvider == null)
4043        if (Configuration.errorOnAutoCreate())
4044          throw new Error("Attempt to auto-create ClaimResponse.requestProvider");
4045        else if (Configuration.doAutoCreate())
4046          this.requestProvider = new Reference(); // cc
4047      return this.requestProvider;
4048    }
4049
4050    public boolean hasRequestProvider() { 
4051      return this.requestProvider != null && !this.requestProvider.isEmpty();
4052    }
4053
4054    /**
4055     * @param value {@link #requestProvider} (The practitioner who is responsible for the services rendered to the patient.)
4056     */
4057    public ClaimResponse setRequestProvider(Reference value) { 
4058      this.requestProvider = value;
4059      return this;
4060    }
4061
4062    /**
4063     * @return {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
4064     */
4065    public Practitioner getRequestProviderTarget() { 
4066      if (this.requestProviderTarget == null)
4067        if (Configuration.errorOnAutoCreate())
4068          throw new Error("Attempt to auto-create ClaimResponse.requestProvider");
4069        else if (Configuration.doAutoCreate())
4070          this.requestProviderTarget = new Practitioner(); // aa
4071      return this.requestProviderTarget;
4072    }
4073
4074    /**
4075     * @param value {@link #requestProvider} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The practitioner who is responsible for the services rendered to the patient.)
4076     */
4077    public ClaimResponse setRequestProviderTarget(Practitioner value) { 
4078      this.requestProviderTarget = value;
4079      return this;
4080    }
4081
4082    /**
4083     * @return {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
4084     */
4085    public Reference getRequestOrganization() { 
4086      if (this.requestOrganization == null)
4087        if (Configuration.errorOnAutoCreate())
4088          throw new Error("Attempt to auto-create ClaimResponse.requestOrganization");
4089        else if (Configuration.doAutoCreate())
4090          this.requestOrganization = new Reference(); // cc
4091      return this.requestOrganization;
4092    }
4093
4094    public boolean hasRequestOrganization() { 
4095      return this.requestOrganization != null && !this.requestOrganization.isEmpty();
4096    }
4097
4098    /**
4099     * @param value {@link #requestOrganization} (The organization which is responsible for the services rendered to the patient.)
4100     */
4101    public ClaimResponse setRequestOrganization(Reference value) { 
4102      this.requestOrganization = value;
4103      return this;
4104    }
4105
4106    /**
4107     * @return {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
4108     */
4109    public Organization getRequestOrganizationTarget() { 
4110      if (this.requestOrganizationTarget == null)
4111        if (Configuration.errorOnAutoCreate())
4112          throw new Error("Attempt to auto-create ClaimResponse.requestOrganization");
4113        else if (Configuration.doAutoCreate())
4114          this.requestOrganizationTarget = new Organization(); // aa
4115      return this.requestOrganizationTarget;
4116    }
4117
4118    /**
4119     * @param value {@link #requestOrganization} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The organization which is responsible for the services rendered to the patient.)
4120     */
4121    public ClaimResponse setRequestOrganizationTarget(Organization value) { 
4122      this.requestOrganizationTarget = value;
4123      return this;
4124    }
4125
4126    /**
4127     * @return {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
4128     */
4129    public Enumeration<RemittanceOutcome> getOutcomeElement() { 
4130      if (this.outcome == null)
4131        if (Configuration.errorOnAutoCreate())
4132          throw new Error("Attempt to auto-create ClaimResponse.outcome");
4133        else if (Configuration.doAutoCreate())
4134          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory()); // bb
4135      return this.outcome;
4136    }
4137
4138    public boolean hasOutcomeElement() { 
4139      return this.outcome != null && !this.outcome.isEmpty();
4140    }
4141
4142    public boolean hasOutcome() { 
4143      return this.outcome != null && !this.outcome.isEmpty();
4144    }
4145
4146    /**
4147     * @param value {@link #outcome} (Transaction status: error, complete.). This is the underlying object with id, value and extensions. The accessor "getOutcome" gives direct access to the value
4148     */
4149    public ClaimResponse setOutcomeElement(Enumeration<RemittanceOutcome> value) { 
4150      this.outcome = value;
4151      return this;
4152    }
4153
4154    /**
4155     * @return Transaction status: error, complete.
4156     */
4157    public RemittanceOutcome getOutcome() { 
4158      return this.outcome == null ? null : this.outcome.getValue();
4159    }
4160
4161    /**
4162     * @param value Transaction status: error, complete.
4163     */
4164    public ClaimResponse setOutcome(RemittanceOutcome value) { 
4165      if (value == null)
4166        this.outcome = null;
4167      else {
4168        if (this.outcome == null)
4169          this.outcome = new Enumeration<RemittanceOutcome>(new RemittanceOutcomeEnumFactory());
4170        this.outcome.setValue(value);
4171      }
4172      return this;
4173    }
4174
4175    /**
4176     * @return {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
4177     */
4178    public StringType getDispositionElement() { 
4179      if (this.disposition == null)
4180        if (Configuration.errorOnAutoCreate())
4181          throw new Error("Attempt to auto-create ClaimResponse.disposition");
4182        else if (Configuration.doAutoCreate())
4183          this.disposition = new StringType(); // bb
4184      return this.disposition;
4185    }
4186
4187    public boolean hasDispositionElement() { 
4188      return this.disposition != null && !this.disposition.isEmpty();
4189    }
4190
4191    public boolean hasDisposition() { 
4192      return this.disposition != null && !this.disposition.isEmpty();
4193    }
4194
4195    /**
4196     * @param value {@link #disposition} (A description of the status of the adjudication.). This is the underlying object with id, value and extensions. The accessor "getDisposition" gives direct access to the value
4197     */
4198    public ClaimResponse setDispositionElement(StringType value) { 
4199      this.disposition = value;
4200      return this;
4201    }
4202
4203    /**
4204     * @return A description of the status of the adjudication.
4205     */
4206    public String getDisposition() { 
4207      return this.disposition == null ? null : this.disposition.getValue();
4208    }
4209
4210    /**
4211     * @param value A description of the status of the adjudication.
4212     */
4213    public ClaimResponse setDisposition(String value) { 
4214      if (Utilities.noString(value))
4215        this.disposition = null;
4216      else {
4217        if (this.disposition == null)
4218          this.disposition = new StringType();
4219        this.disposition.setValue(value);
4220      }
4221      return this;
4222    }
4223
4224    /**
4225     * @return {@link #payeeType} (Party to be reimbursed: Subscriber, provider, other.)
4226     */
4227    public Coding getPayeeType() { 
4228      if (this.payeeType == null)
4229        if (Configuration.errorOnAutoCreate())
4230          throw new Error("Attempt to auto-create ClaimResponse.payeeType");
4231        else if (Configuration.doAutoCreate())
4232          this.payeeType = new Coding(); // cc
4233      return this.payeeType;
4234    }
4235
4236    public boolean hasPayeeType() { 
4237      return this.payeeType != null && !this.payeeType.isEmpty();
4238    }
4239
4240    /**
4241     * @param value {@link #payeeType} (Party to be reimbursed: Subscriber, provider, other.)
4242     */
4243    public ClaimResponse setPayeeType(Coding value) { 
4244      this.payeeType = value;
4245      return this;
4246    }
4247
4248    /**
4249     * @return {@link #item} (The first tier service adjudications for submitted services.)
4250     */
4251    public List<ItemsComponent> getItem() { 
4252      if (this.item == null)
4253        this.item = new ArrayList<ItemsComponent>();
4254      return this.item;
4255    }
4256
4257    public boolean hasItem() { 
4258      if (this.item == null)
4259        return false;
4260      for (ItemsComponent item : this.item)
4261        if (!item.isEmpty())
4262          return true;
4263      return false;
4264    }
4265
4266    /**
4267     * @return {@link #item} (The first tier service adjudications for submitted services.)
4268     */
4269    // syntactic sugar
4270    public ItemsComponent addItem() { //3
4271      ItemsComponent t = new ItemsComponent();
4272      if (this.item == null)
4273        this.item = new ArrayList<ItemsComponent>();
4274      this.item.add(t);
4275      return t;
4276    }
4277
4278    // syntactic sugar
4279    public ClaimResponse addItem(ItemsComponent t) { //3
4280      if (t == null)
4281        return this;
4282      if (this.item == null)
4283        this.item = new ArrayList<ItemsComponent>();
4284      this.item.add(t);
4285      return this;
4286    }
4287
4288    /**
4289     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
4290     */
4291    public List<AddedItemComponent> getAddItem() { 
4292      if (this.addItem == null)
4293        this.addItem = new ArrayList<AddedItemComponent>();
4294      return this.addItem;
4295    }
4296
4297    public boolean hasAddItem() { 
4298      if (this.addItem == null)
4299        return false;
4300      for (AddedItemComponent item : this.addItem)
4301        if (!item.isEmpty())
4302          return true;
4303      return false;
4304    }
4305
4306    /**
4307     * @return {@link #addItem} (The first tier service adjudications for payor added services.)
4308     */
4309    // syntactic sugar
4310    public AddedItemComponent addAddItem() { //3
4311      AddedItemComponent t = new AddedItemComponent();
4312      if (this.addItem == null)
4313        this.addItem = new ArrayList<AddedItemComponent>();
4314      this.addItem.add(t);
4315      return t;
4316    }
4317
4318    // syntactic sugar
4319    public ClaimResponse addAddItem(AddedItemComponent t) { //3
4320      if (t == null)
4321        return this;
4322      if (this.addItem == null)
4323        this.addItem = new ArrayList<AddedItemComponent>();
4324      this.addItem.add(t);
4325      return this;
4326    }
4327
4328    /**
4329     * @return {@link #error} (Mutually exclusive with Services Provided (Item).)
4330     */
4331    public List<ErrorsComponent> getError() { 
4332      if (this.error == null)
4333        this.error = new ArrayList<ErrorsComponent>();
4334      return this.error;
4335    }
4336
4337    public boolean hasError() { 
4338      if (this.error == null)
4339        return false;
4340      for (ErrorsComponent item : this.error)
4341        if (!item.isEmpty())
4342          return true;
4343      return false;
4344    }
4345
4346    /**
4347     * @return {@link #error} (Mutually exclusive with Services Provided (Item).)
4348     */
4349    // syntactic sugar
4350    public ErrorsComponent addError() { //3
4351      ErrorsComponent t = new ErrorsComponent();
4352      if (this.error == null)
4353        this.error = new ArrayList<ErrorsComponent>();
4354      this.error.add(t);
4355      return t;
4356    }
4357
4358    // syntactic sugar
4359    public ClaimResponse addError(ErrorsComponent t) { //3
4360      if (t == null)
4361        return this;
4362      if (this.error == null)
4363        this.error = new ArrayList<ErrorsComponent>();
4364      this.error.add(t);
4365      return this;
4366    }
4367
4368    /**
4369     * @return {@link #totalCost} (The total cost of the services reported.)
4370     */
4371    public Money getTotalCost() { 
4372      if (this.totalCost == null)
4373        if (Configuration.errorOnAutoCreate())
4374          throw new Error("Attempt to auto-create ClaimResponse.totalCost");
4375        else if (Configuration.doAutoCreate())
4376          this.totalCost = new Money(); // cc
4377      return this.totalCost;
4378    }
4379
4380    public boolean hasTotalCost() { 
4381      return this.totalCost != null && !this.totalCost.isEmpty();
4382    }
4383
4384    /**
4385     * @param value {@link #totalCost} (The total cost of the services reported.)
4386     */
4387    public ClaimResponse setTotalCost(Money value) { 
4388      this.totalCost = value;
4389      return this;
4390    }
4391
4392    /**
4393     * @return {@link #unallocDeductable} (The amount of deductible applied which was not allocated to any particular service line.)
4394     */
4395    public Money getUnallocDeductable() { 
4396      if (this.unallocDeductable == null)
4397        if (Configuration.errorOnAutoCreate())
4398          throw new Error("Attempt to auto-create ClaimResponse.unallocDeductable");
4399        else if (Configuration.doAutoCreate())
4400          this.unallocDeductable = new Money(); // cc
4401      return this.unallocDeductable;
4402    }
4403
4404    public boolean hasUnallocDeductable() { 
4405      return this.unallocDeductable != null && !this.unallocDeductable.isEmpty();
4406    }
4407
4408    /**
4409     * @param value {@link #unallocDeductable} (The amount of deductible applied which was not allocated to any particular service line.)
4410     */
4411    public ClaimResponse setUnallocDeductable(Money value) { 
4412      this.unallocDeductable = value;
4413      return this;
4414    }
4415
4416    /**
4417     * @return {@link #totalBenefit} (Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible).)
4418     */
4419    public Money getTotalBenefit() { 
4420      if (this.totalBenefit == null)
4421        if (Configuration.errorOnAutoCreate())
4422          throw new Error("Attempt to auto-create ClaimResponse.totalBenefit");
4423        else if (Configuration.doAutoCreate())
4424          this.totalBenefit = new Money(); // cc
4425      return this.totalBenefit;
4426    }
4427
4428    public boolean hasTotalBenefit() { 
4429      return this.totalBenefit != null && !this.totalBenefit.isEmpty();
4430    }
4431
4432    /**
4433     * @param value {@link #totalBenefit} (Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible).)
4434     */
4435    public ClaimResponse setTotalBenefit(Money value) { 
4436      this.totalBenefit = value;
4437      return this;
4438    }
4439
4440    /**
4441     * @return {@link #paymentAdjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
4442     */
4443    public Money getPaymentAdjustment() { 
4444      if (this.paymentAdjustment == null)
4445        if (Configuration.errorOnAutoCreate())
4446          throw new Error("Attempt to auto-create ClaimResponse.paymentAdjustment");
4447        else if (Configuration.doAutoCreate())
4448          this.paymentAdjustment = new Money(); // cc
4449      return this.paymentAdjustment;
4450    }
4451
4452    public boolean hasPaymentAdjustment() { 
4453      return this.paymentAdjustment != null && !this.paymentAdjustment.isEmpty();
4454    }
4455
4456    /**
4457     * @param value {@link #paymentAdjustment} (Adjustment to the payment of this transaction which is not related to adjudication of this transaction.)
4458     */
4459    public ClaimResponse setPaymentAdjustment(Money value) { 
4460      this.paymentAdjustment = value;
4461      return this;
4462    }
4463
4464    /**
4465     * @return {@link #paymentAdjustmentReason} (Reason for the payment adjustment.)
4466     */
4467    public Coding getPaymentAdjustmentReason() { 
4468      if (this.paymentAdjustmentReason == null)
4469        if (Configuration.errorOnAutoCreate())
4470          throw new Error("Attempt to auto-create ClaimResponse.paymentAdjustmentReason");
4471        else if (Configuration.doAutoCreate())
4472          this.paymentAdjustmentReason = new Coding(); // cc
4473      return this.paymentAdjustmentReason;
4474    }
4475
4476    public boolean hasPaymentAdjustmentReason() { 
4477      return this.paymentAdjustmentReason != null && !this.paymentAdjustmentReason.isEmpty();
4478    }
4479
4480    /**
4481     * @param value {@link #paymentAdjustmentReason} (Reason for the payment adjustment.)
4482     */
4483    public ClaimResponse setPaymentAdjustmentReason(Coding value) { 
4484      this.paymentAdjustmentReason = value;
4485      return this;
4486    }
4487
4488    /**
4489     * @return {@link #paymentDate} (Estimated payment data.). This is the underlying object with id, value and extensions. The accessor "getPaymentDate" gives direct access to the value
4490     */
4491    public DateType getPaymentDateElement() { 
4492      if (this.paymentDate == null)
4493        if (Configuration.errorOnAutoCreate())
4494          throw new Error("Attempt to auto-create ClaimResponse.paymentDate");
4495        else if (Configuration.doAutoCreate())
4496          this.paymentDate = new DateType(); // bb
4497      return this.paymentDate;
4498    }
4499
4500    public boolean hasPaymentDateElement() { 
4501      return this.paymentDate != null && !this.paymentDate.isEmpty();
4502    }
4503
4504    public boolean hasPaymentDate() { 
4505      return this.paymentDate != null && !this.paymentDate.isEmpty();
4506    }
4507
4508    /**
4509     * @param value {@link #paymentDate} (Estimated payment data.). This is the underlying object with id, value and extensions. The accessor "getPaymentDate" gives direct access to the value
4510     */
4511    public ClaimResponse setPaymentDateElement(DateType value) { 
4512      this.paymentDate = value;
4513      return this;
4514    }
4515
4516    /**
4517     * @return Estimated payment data.
4518     */
4519    public Date getPaymentDate() { 
4520      return this.paymentDate == null ? null : this.paymentDate.getValue();
4521    }
4522
4523    /**
4524     * @param value Estimated payment data.
4525     */
4526    public ClaimResponse setPaymentDate(Date value) { 
4527      if (value == null)
4528        this.paymentDate = null;
4529      else {
4530        if (this.paymentDate == null)
4531          this.paymentDate = new DateType();
4532        this.paymentDate.setValue(value);
4533      }
4534      return this;
4535    }
4536
4537    /**
4538     * @return {@link #paymentAmount} (Payable less any payment adjustment.)
4539     */
4540    public Money getPaymentAmount() { 
4541      if (this.paymentAmount == null)
4542        if (Configuration.errorOnAutoCreate())
4543          throw new Error("Attempt to auto-create ClaimResponse.paymentAmount");
4544        else if (Configuration.doAutoCreate())
4545          this.paymentAmount = new Money(); // cc
4546      return this.paymentAmount;
4547    }
4548
4549    public boolean hasPaymentAmount() { 
4550      return this.paymentAmount != null && !this.paymentAmount.isEmpty();
4551    }
4552
4553    /**
4554     * @param value {@link #paymentAmount} (Payable less any payment adjustment.)
4555     */
4556    public ClaimResponse setPaymentAmount(Money value) { 
4557      this.paymentAmount = value;
4558      return this;
4559    }
4560
4561    /**
4562     * @return {@link #paymentRef} (Payment identifier.)
4563     */
4564    public Identifier getPaymentRef() { 
4565      if (this.paymentRef == null)
4566        if (Configuration.errorOnAutoCreate())
4567          throw new Error("Attempt to auto-create ClaimResponse.paymentRef");
4568        else if (Configuration.doAutoCreate())
4569          this.paymentRef = new Identifier(); // cc
4570      return this.paymentRef;
4571    }
4572
4573    public boolean hasPaymentRef() { 
4574      return this.paymentRef != null && !this.paymentRef.isEmpty();
4575    }
4576
4577    /**
4578     * @param value {@link #paymentRef} (Payment identifier.)
4579     */
4580    public ClaimResponse setPaymentRef(Identifier value) { 
4581      this.paymentRef = value;
4582      return this;
4583    }
4584
4585    /**
4586     * @return {@link #reserved} (Status of funds reservation (For provider, for Patient, None).)
4587     */
4588    public Coding getReserved() { 
4589      if (this.reserved == null)
4590        if (Configuration.errorOnAutoCreate())
4591          throw new Error("Attempt to auto-create ClaimResponse.reserved");
4592        else if (Configuration.doAutoCreate())
4593          this.reserved = new Coding(); // cc
4594      return this.reserved;
4595    }
4596
4597    public boolean hasReserved() { 
4598      return this.reserved != null && !this.reserved.isEmpty();
4599    }
4600
4601    /**
4602     * @param value {@link #reserved} (Status of funds reservation (For provider, for Patient, None).)
4603     */
4604    public ClaimResponse setReserved(Coding value) { 
4605      this.reserved = value;
4606      return this;
4607    }
4608
4609    /**
4610     * @return {@link #form} (The form to be used for printing the content.)
4611     */
4612    public Coding getForm() { 
4613      if (this.form == null)
4614        if (Configuration.errorOnAutoCreate())
4615          throw new Error("Attempt to auto-create ClaimResponse.form");
4616        else if (Configuration.doAutoCreate())
4617          this.form = new Coding(); // cc
4618      return this.form;
4619    }
4620
4621    public boolean hasForm() { 
4622      return this.form != null && !this.form.isEmpty();
4623    }
4624
4625    /**
4626     * @param value {@link #form} (The form to be used for printing the content.)
4627     */
4628    public ClaimResponse setForm(Coding value) { 
4629      this.form = value;
4630      return this;
4631    }
4632
4633    /**
4634     * @return {@link #note} (Note text.)
4635     */
4636    public List<NotesComponent> getNote() { 
4637      if (this.note == null)
4638        this.note = new ArrayList<NotesComponent>();
4639      return this.note;
4640    }
4641
4642    public boolean hasNote() { 
4643      if (this.note == null)
4644        return false;
4645      for (NotesComponent item : this.note)
4646        if (!item.isEmpty())
4647          return true;
4648      return false;
4649    }
4650
4651    /**
4652     * @return {@link #note} (Note text.)
4653     */
4654    // syntactic sugar
4655    public NotesComponent addNote() { //3
4656      NotesComponent t = new NotesComponent();
4657      if (this.note == null)
4658        this.note = new ArrayList<NotesComponent>();
4659      this.note.add(t);
4660      return t;
4661    }
4662
4663    // syntactic sugar
4664    public ClaimResponse addNote(NotesComponent t) { //3
4665      if (t == null)
4666        return this;
4667      if (this.note == null)
4668        this.note = new ArrayList<NotesComponent>();
4669      this.note.add(t);
4670      return this;
4671    }
4672
4673    /**
4674     * @return {@link #coverage} (Financial instrument by which payment information for health care.)
4675     */
4676    public List<CoverageComponent> getCoverage() { 
4677      if (this.coverage == null)
4678        this.coverage = new ArrayList<CoverageComponent>();
4679      return this.coverage;
4680    }
4681
4682    public boolean hasCoverage() { 
4683      if (this.coverage == null)
4684        return false;
4685      for (CoverageComponent item : this.coverage)
4686        if (!item.isEmpty())
4687          return true;
4688      return false;
4689    }
4690
4691    /**
4692     * @return {@link #coverage} (Financial instrument by which payment information for health care.)
4693     */
4694    // syntactic sugar
4695    public CoverageComponent addCoverage() { //3
4696      CoverageComponent t = new CoverageComponent();
4697      if (this.coverage == null)
4698        this.coverage = new ArrayList<CoverageComponent>();
4699      this.coverage.add(t);
4700      return t;
4701    }
4702
4703    // syntactic sugar
4704    public ClaimResponse addCoverage(CoverageComponent t) { //3
4705      if (t == null)
4706        return this;
4707      if (this.coverage == null)
4708        this.coverage = new ArrayList<CoverageComponent>();
4709      this.coverage.add(t);
4710      return this;
4711    }
4712
4713      protected void listChildren(List<Property> childrenList) {
4714        super.listChildren(childrenList);
4715        childrenList.add(new Property("identifier", "Identifier", "The Response business identifier.", 0, java.lang.Integer.MAX_VALUE, identifier));
4716        childrenList.add(new Property("request", "Reference(Claim)", "Original request resource referrence.", 0, java.lang.Integer.MAX_VALUE, request));
4717        childrenList.add(new Property("ruleset", "Coding", "The version of the style of resource contents. This should be mapped to the allowable profiles for this and supporting resources.", 0, java.lang.Integer.MAX_VALUE, ruleset));
4718        childrenList.add(new Property("originalRuleset", "Coding", "The style (standard) and version of the original material which was converted into this resource.", 0, java.lang.Integer.MAX_VALUE, originalRuleset));
4719        childrenList.add(new Property("created", "dateTime", "The date when the enclosed suite of services were performed or completed.", 0, java.lang.Integer.MAX_VALUE, created));
4720        childrenList.add(new Property("organization", "Reference(Organization)", "The Insurer who produced this adjudicated response.", 0, java.lang.Integer.MAX_VALUE, organization));
4721        childrenList.add(new Property("requestProvider", "Reference(Practitioner)", "The practitioner who is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestProvider));
4722        childrenList.add(new Property("requestOrganization", "Reference(Organization)", "The organization which is responsible for the services rendered to the patient.", 0, java.lang.Integer.MAX_VALUE, requestOrganization));
4723        childrenList.add(new Property("outcome", "code", "Transaction status: error, complete.", 0, java.lang.Integer.MAX_VALUE, outcome));
4724        childrenList.add(new Property("disposition", "string", "A description of the status of the adjudication.", 0, java.lang.Integer.MAX_VALUE, disposition));
4725        childrenList.add(new Property("payeeType", "Coding", "Party to be reimbursed: Subscriber, provider, other.", 0, java.lang.Integer.MAX_VALUE, payeeType));
4726        childrenList.add(new Property("item", "", "The first tier service adjudications for submitted services.", 0, java.lang.Integer.MAX_VALUE, item));
4727        childrenList.add(new Property("addItem", "", "The first tier service adjudications for payor added services.", 0, java.lang.Integer.MAX_VALUE, addItem));
4728        childrenList.add(new Property("error", "", "Mutually exclusive with Services Provided (Item).", 0, java.lang.Integer.MAX_VALUE, error));
4729        childrenList.add(new Property("totalCost", "Money", "The total cost of the services reported.", 0, java.lang.Integer.MAX_VALUE, totalCost));
4730        childrenList.add(new Property("unallocDeductable", "Money", "The amount of deductible applied which was not allocated to any particular service line.", 0, java.lang.Integer.MAX_VALUE, unallocDeductable));
4731        childrenList.add(new Property("totalBenefit", "Money", "Total amount of benefit payable (Equal to sum of the Benefit amounts from all detail lines and additions less the Unallocated Deductible).", 0, java.lang.Integer.MAX_VALUE, totalBenefit));
4732        childrenList.add(new Property("paymentAdjustment", "Money", "Adjustment to the payment of this transaction which is not related to adjudication of this transaction.", 0, java.lang.Integer.MAX_VALUE, paymentAdjustment));
4733        childrenList.add(new Property("paymentAdjustmentReason", "Coding", "Reason for the payment adjustment.", 0, java.lang.Integer.MAX_VALUE, paymentAdjustmentReason));
4734        childrenList.add(new Property("paymentDate", "date", "Estimated payment data.", 0, java.lang.Integer.MAX_VALUE, paymentDate));
4735        childrenList.add(new Property("paymentAmount", "Money", "Payable less any payment adjustment.", 0, java.lang.Integer.MAX_VALUE, paymentAmount));
4736        childrenList.add(new Property("paymentRef", "Identifier", "Payment identifier.", 0, java.lang.Integer.MAX_VALUE, paymentRef));
4737        childrenList.add(new Property("reserved", "Coding", "Status of funds reservation (For provider, for Patient, None).", 0, java.lang.Integer.MAX_VALUE, reserved));
4738        childrenList.add(new Property("form", "Coding", "The form to be used for printing the content.", 0, java.lang.Integer.MAX_VALUE, form));
4739        childrenList.add(new Property("note", "", "Note text.", 0, java.lang.Integer.MAX_VALUE, note));
4740        childrenList.add(new Property("coverage", "", "Financial instrument by which payment information for health care.", 0, java.lang.Integer.MAX_VALUE, coverage));
4741      }
4742
4743      @Override
4744      public void setProperty(String name, Base value) throws FHIRException {
4745        if (name.equals("identifier"))
4746          this.getIdentifier().add(castToIdentifier(value));
4747        else if (name.equals("request"))
4748          this.request = castToReference(value); // Reference
4749        else if (name.equals("ruleset"))
4750          this.ruleset = castToCoding(value); // Coding
4751        else if (name.equals("originalRuleset"))
4752          this.originalRuleset = castToCoding(value); // Coding
4753        else if (name.equals("created"))
4754          this.created = castToDateTime(value); // DateTimeType
4755        else if (name.equals("organization"))
4756          this.organization = castToReference(value); // Reference
4757        else if (name.equals("requestProvider"))
4758          this.requestProvider = castToReference(value); // Reference
4759        else if (name.equals("requestOrganization"))
4760          this.requestOrganization = castToReference(value); // Reference
4761        else if (name.equals("outcome"))
4762          this.outcome = new RemittanceOutcomeEnumFactory().fromType(value); // Enumeration<RemittanceOutcome>
4763        else if (name.equals("disposition"))
4764          this.disposition = castToString(value); // StringType
4765        else if (name.equals("payeeType"))
4766          this.payeeType = castToCoding(value); // Coding
4767        else if (name.equals("item"))
4768          this.getItem().add((ItemsComponent) value);
4769        else if (name.equals("addItem"))
4770          this.getAddItem().add((AddedItemComponent) value);
4771        else if (name.equals("error"))
4772          this.getError().add((ErrorsComponent) value);
4773        else if (name.equals("totalCost"))
4774          this.totalCost = castToMoney(value); // Money
4775        else if (name.equals("unallocDeductable"))
4776          this.unallocDeductable = castToMoney(value); // Money
4777        else if (name.equals("totalBenefit"))
4778          this.totalBenefit = castToMoney(value); // Money
4779        else if (name.equals("paymentAdjustment"))
4780          this.paymentAdjustment = castToMoney(value); // Money
4781        else if (name.equals("paymentAdjustmentReason"))
4782          this.paymentAdjustmentReason = castToCoding(value); // Coding
4783        else if (name.equals("paymentDate"))
4784          this.paymentDate = castToDate(value); // DateType
4785        else if (name.equals("paymentAmount"))
4786          this.paymentAmount = castToMoney(value); // Money
4787        else if (name.equals("paymentRef"))
4788          this.paymentRef = castToIdentifier(value); // Identifier
4789        else if (name.equals("reserved"))
4790          this.reserved = castToCoding(value); // Coding
4791        else if (name.equals("form"))
4792          this.form = castToCoding(value); // Coding
4793        else if (name.equals("note"))
4794          this.getNote().add((NotesComponent) value);
4795        else if (name.equals("coverage"))
4796          this.getCoverage().add((CoverageComponent) value);
4797        else
4798          super.setProperty(name, value);
4799      }
4800
4801      @Override
4802      public Base addChild(String name) throws FHIRException {
4803        if (name.equals("identifier")) {
4804          return addIdentifier();
4805        }
4806        else if (name.equals("request")) {
4807          this.request = new Reference();
4808          return this.request;
4809        }
4810        else if (name.equals("ruleset")) {
4811          this.ruleset = new Coding();
4812          return this.ruleset;
4813        }
4814        else if (name.equals("originalRuleset")) {
4815          this.originalRuleset = new Coding();
4816          return this.originalRuleset;
4817        }
4818        else if (name.equals("created")) {
4819          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.created");
4820        }
4821        else if (name.equals("organization")) {
4822          this.organization = new Reference();
4823          return this.organization;
4824        }
4825        else if (name.equals("requestProvider")) {
4826          this.requestProvider = new Reference();
4827          return this.requestProvider;
4828        }
4829        else if (name.equals("requestOrganization")) {
4830          this.requestOrganization = new Reference();
4831          return this.requestOrganization;
4832        }
4833        else if (name.equals("outcome")) {
4834          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.outcome");
4835        }
4836        else if (name.equals("disposition")) {
4837          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.disposition");
4838        }
4839        else if (name.equals("payeeType")) {
4840          this.payeeType = new Coding();
4841          return this.payeeType;
4842        }
4843        else if (name.equals("item")) {
4844          return addItem();
4845        }
4846        else if (name.equals("addItem")) {
4847          return addAddItem();
4848        }
4849        else if (name.equals("error")) {
4850          return addError();
4851        }
4852        else if (name.equals("totalCost")) {
4853          this.totalCost = new Money();
4854          return this.totalCost;
4855        }
4856        else if (name.equals("unallocDeductable")) {
4857          this.unallocDeductable = new Money();
4858          return this.unallocDeductable;
4859        }
4860        else if (name.equals("totalBenefit")) {
4861          this.totalBenefit = new Money();
4862          return this.totalBenefit;
4863        }
4864        else if (name.equals("paymentAdjustment")) {
4865          this.paymentAdjustment = new Money();
4866          return this.paymentAdjustment;
4867        }
4868        else if (name.equals("paymentAdjustmentReason")) {
4869          this.paymentAdjustmentReason = new Coding();
4870          return this.paymentAdjustmentReason;
4871        }
4872        else if (name.equals("paymentDate")) {
4873          throw new FHIRException("Cannot call addChild on a primitive type ClaimResponse.paymentDate");
4874        }
4875        else if (name.equals("paymentAmount")) {
4876          this.paymentAmount = new Money();
4877          return this.paymentAmount;
4878        }
4879        else if (name.equals("paymentRef")) {
4880          this.paymentRef = new Identifier();
4881          return this.paymentRef;
4882        }
4883        else if (name.equals("reserved")) {
4884          this.reserved = new Coding();
4885          return this.reserved;
4886        }
4887        else if (name.equals("form")) {
4888          this.form = new Coding();
4889          return this.form;
4890        }
4891        else if (name.equals("note")) {
4892          return addNote();
4893        }
4894        else if (name.equals("coverage")) {
4895          return addCoverage();
4896        }
4897        else
4898          return super.addChild(name);
4899      }
4900
4901  public String fhirType() {
4902    return "ClaimResponse";
4903
4904  }
4905
4906      public ClaimResponse copy() {
4907        ClaimResponse dst = new ClaimResponse();
4908        copyValues(dst);
4909        if (identifier != null) {
4910          dst.identifier = new ArrayList<Identifier>();
4911          for (Identifier i : identifier)
4912            dst.identifier.add(i.copy());
4913        };
4914        dst.request = request == null ? null : request.copy();
4915        dst.ruleset = ruleset == null ? null : ruleset.copy();
4916        dst.originalRuleset = originalRuleset == null ? null : originalRuleset.copy();
4917        dst.created = created == null ? null : created.copy();
4918        dst.organization = organization == null ? null : organization.copy();
4919        dst.requestProvider = requestProvider == null ? null : requestProvider.copy();
4920        dst.requestOrganization = requestOrganization == null ? null : requestOrganization.copy();
4921        dst.outcome = outcome == null ? null : outcome.copy();
4922        dst.disposition = disposition == null ? null : disposition.copy();
4923        dst.payeeType = payeeType == null ? null : payeeType.copy();
4924        if (item != null) {
4925          dst.item = new ArrayList<ItemsComponent>();
4926          for (ItemsComponent i : item)
4927            dst.item.add(i.copy());
4928        };
4929        if (addItem != null) {
4930          dst.addItem = new ArrayList<AddedItemComponent>();
4931          for (AddedItemComponent i : addItem)
4932            dst.addItem.add(i.copy());
4933        };
4934        if (error != null) {
4935          dst.error = new ArrayList<ErrorsComponent>();
4936          for (ErrorsComponent i : error)
4937            dst.error.add(i.copy());
4938        };
4939        dst.totalCost = totalCost == null ? null : totalCost.copy();
4940        dst.unallocDeductable = unallocDeductable == null ? null : unallocDeductable.copy();
4941        dst.totalBenefit = totalBenefit == null ? null : totalBenefit.copy();
4942        dst.paymentAdjustment = paymentAdjustment == null ? null : paymentAdjustment.copy();
4943        dst.paymentAdjustmentReason = paymentAdjustmentReason == null ? null : paymentAdjustmentReason.copy();
4944        dst.paymentDate = paymentDate == null ? null : paymentDate.copy();
4945        dst.paymentAmount = paymentAmount == null ? null : paymentAmount.copy();
4946        dst.paymentRef = paymentRef == null ? null : paymentRef.copy();
4947        dst.reserved = reserved == null ? null : reserved.copy();
4948        dst.form = form == null ? null : form.copy();
4949        if (note != null) {
4950          dst.note = new ArrayList<NotesComponent>();
4951          for (NotesComponent i : note)
4952            dst.note.add(i.copy());
4953        };
4954        if (coverage != null) {
4955          dst.coverage = new ArrayList<CoverageComponent>();
4956          for (CoverageComponent i : coverage)
4957            dst.coverage.add(i.copy());
4958        };
4959        return dst;
4960      }
4961
4962      protected ClaimResponse typedCopy() {
4963        return copy();
4964      }
4965
4966      @Override
4967      public boolean equalsDeep(Base other) {
4968        if (!super.equalsDeep(other))
4969          return false;
4970        if (!(other instanceof ClaimResponse))
4971          return false;
4972        ClaimResponse o = (ClaimResponse) other;
4973        return compareDeep(identifier, o.identifier, true) && compareDeep(request, o.request, true) && compareDeep(ruleset, o.ruleset, true)
4974           && compareDeep(originalRuleset, o.originalRuleset, true) && compareDeep(created, o.created, true)
4975           && compareDeep(organization, o.organization, true) && compareDeep(requestProvider, o.requestProvider, true)
4976           && compareDeep(requestOrganization, o.requestOrganization, true) && compareDeep(outcome, o.outcome, true)
4977           && compareDeep(disposition, o.disposition, true) && compareDeep(payeeType, o.payeeType, true) && compareDeep(item, o.item, true)
4978           && compareDeep(addItem, o.addItem, true) && compareDeep(error, o.error, true) && compareDeep(totalCost, o.totalCost, true)
4979           && compareDeep(unallocDeductable, o.unallocDeductable, true) && compareDeep(totalBenefit, o.totalBenefit, true)
4980           && compareDeep(paymentAdjustment, o.paymentAdjustment, true) && compareDeep(paymentAdjustmentReason, o.paymentAdjustmentReason, true)
4981           && compareDeep(paymentDate, o.paymentDate, true) && compareDeep(paymentAmount, o.paymentAmount, true)
4982           && compareDeep(paymentRef, o.paymentRef, true) && compareDeep(reserved, o.reserved, true) && compareDeep(form, o.form, true)
4983           && compareDeep(note, o.note, true) && compareDeep(coverage, o.coverage, true);
4984      }
4985
4986      @Override
4987      public boolean equalsShallow(Base other) {
4988        if (!super.equalsShallow(other))
4989          return false;
4990        if (!(other instanceof ClaimResponse))
4991          return false;
4992        ClaimResponse o = (ClaimResponse) other;
4993        return compareValues(created, o.created, true) && compareValues(outcome, o.outcome, true) && compareValues(disposition, o.disposition, true)
4994           && compareValues(paymentDate, o.paymentDate, true);
4995      }
4996
4997      public boolean isEmpty() {
4998        return super.isEmpty() && (identifier == null || identifier.isEmpty()) && (request == null || request.isEmpty())
4999           && (ruleset == null || ruleset.isEmpty()) && (originalRuleset == null || originalRuleset.isEmpty())
5000           && (created == null || created.isEmpty()) && (organization == null || organization.isEmpty())
5001           && (requestProvider == null || requestProvider.isEmpty()) && (requestOrganization == null || requestOrganization.isEmpty())
5002           && (outcome == null || outcome.isEmpty()) && (disposition == null || disposition.isEmpty())
5003           && (payeeType == null || payeeType.isEmpty()) && (item == null || item.isEmpty()) && (addItem == null || addItem.isEmpty())
5004           && (error == null || error.isEmpty()) && (totalCost == null || totalCost.isEmpty()) && (unallocDeductable == null || unallocDeductable.isEmpty())
5005           && (totalBenefit == null || totalBenefit.isEmpty()) && (paymentAdjustment == null || paymentAdjustment.isEmpty())
5006           && (paymentAdjustmentReason == null || paymentAdjustmentReason.isEmpty()) && (paymentDate == null || paymentDate.isEmpty())
5007           && (paymentAmount == null || paymentAmount.isEmpty()) && (paymentRef == null || paymentRef.isEmpty())
5008           && (reserved == null || reserved.isEmpty()) && (form == null || form.isEmpty()) && (note == null || note.isEmpty())
5009           && (coverage == null || coverage.isEmpty());
5010      }
5011
5012  @Override
5013  public ResourceType getResourceType() {
5014    return ResourceType.ClaimResponse;
5015   }
5016
5017  @SearchParamDefinition(name="identifier", path="ClaimResponse.identifier", description="The identity of the insurer", type="token" )
5018  public static final String SP_IDENTIFIER = "identifier";
5019
5020}
5021