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