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